xib

What is File’s owner in XIB in this case?

半城伤御伤魂 提交于 2019-12-06 11:39:52
问题 I've searched for similar questions for quite a while, most of which mentioned UIViewController's xib stuff. I tried to add a xib file for my custom viewController model,and found that its Xib’s File’s Owner should be my custom viewController model's class--that is reasonable. But why the situation differs when i create a xib for my UIView model -- an example as follows: I create my UIView model which named "KWView"(KWView.h and KWView.m) then i create xib for this model, initializing it by

How to auto size UITableViewCell with underlying WKWebKit, so it respects the content of the web view?

。_饼干妹妹 提交于 2019-12-06 11:21:45
问题 In my iOS app I want to display several items that contain some HTML. For this I've build a NewsListViewController that contains a UITableView . For that UITableView (outlet: newsListTableView ) I created a custom UITableViewCell called NewsTableViewCell that will be load into it via delegates. The NewsTableViewCell holds a WKWebKit control that will display my HTML. This is my code: NewsListViewController.swift import UIKit class NewsListViewController: UIViewController { @IBOutlet weak var

Load (and display) a .XIB from the web

别等时光非礼了梦想. 提交于 2019-12-06 11:05:51
问题 I want to be able to download (via a NSURLConnection request) a .XIB file, and have it presented in a view. I have implemented the NSURLConnection, and surely enough, when the connection completes, I am left with a NSString of XML data representing the XIB file. Example: (just the first few lines of many) <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">800</int> <string key="IBDocument

Xcode crashes when I open a specific XIB file

别来无恙 提交于 2019-12-06 10:53:30
问题 I had a XIB file which worked fine until today - when I try to open it in Xcode, the beachball appears and after 1 minute Xcode crashes. Others XIBs work just fine. Also, if I just build and run the project right to my device, its also work (and XIB works at the app). Here is the error message: Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Application Specific Information: ProductBuildVersion

Perform segue from button in XIB

血红的双手。 提交于 2019-12-06 10:10:54
I'm using storyboards for the most of my project, but i have one UIScrollView that consists of multiple views that are loaded from XIB I'm stuck on how to perform a segue when a button is clicked in the XIB What i've done already. Added the views to a scroll view Added a custom button added an IBAcion on the custom button MainViewController NSString *nibName = @"coverArticleView"; NSArray *nibObjects = [NSBundle.mainBundle loadNibNamed:nibName owner:self options:nil]; coverArticle *pageView = [nibObjects objectAtIndex:0]; pageView.articleTitle.text = ob.Title; pageView.articleTitle

How to create project without story board in xcode 6 (swift)?

萝らか妹 提交于 2019-12-06 09:43:16
问题 Can any one has practiced creating project in xcode6 (swift) without storyboard. I am able to implement func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { // Override point for customization after application launch. self.window = UIWindow(frame: UIScreen.mainScreen().bounds) self.window!.backgroundColor = UIColor.whiteColor() self.window!.makeKeyAndVisible() var viewController: ViewController? = ViewController(nibName:

Unable to load two nib (.XIB) for Single ViewController class in Xcode 4.5 [duplicate]

淺唱寂寞╮ 提交于 2019-12-06 09:26:18
问题 This question already has answers here : iOS: Using device modifiers for loading xib files? (4 answers) Trouble with loading a separate XIB for iPad or iPhone (3 answers) Closed 6 years ago . Sorry Guys in advance, I know there are already plenty similar questions are available. I tried all solutions but didn't work any of them for me. I'm Using Xcode 4.5.2 and using two xibs for iphone5/ios6 1> RootViewController5 and for all other devices 2> RootViewController these both nib file has single

Instantiating a UIView from a XIB file with itself as the file's owner?

血红的双手。 提交于 2019-12-06 07:35:35
Let's say I have a XIB file (MyView.xib) containing a single root UIView whose class is some custom UIView subclass (MyView). I want to create an instance of MyView (in code) from the XIB file but I also want the file's owner to be the instance of MyView itself (so that I can link IBOutlets from the XIB to the code). In other words, MyView is the class of the root view in the XIB and it's also set as the file's owner class. I tried something like this inside the MyView implementation: - (id)initFromNib { self = [[[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil] firstObject]

iOS - a NIB's view used across storyboards (for design & animation logic)

一世执手 提交于 2019-12-06 07:33:12
问题 I have a iOS 5 project nearly completed, but there's one View missing everywhere which is the same. It's an alternative to the standard NavigationBar, you can go "back" in the navigation hierarchy with a swipe and it's animating nicely. Ok, because it's hard to do the layout by code I created the empty IB document (HeaderView.xib) where I have a view containing subview and etc. I had the animation code before so I just created a UIView subclass ("HRAnimationView") (and wrote the name of it in

Get the type name of derived type in a static method of base class or extension Swift

巧了我就是萌 提交于 2019-12-06 06:03:40
TL:DR Paste this into Swift playground: import UIKit public protocol NibLoadable { static var nibName: String { get } } extension NibLoadable where Self: UIView { public static var nibName: String { return String(describing: self) } func printName(){ print(Self.nibName) } } public class Shoes: UIView, NibLoadable { required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) printName() } override init(frame: CGRect) { super.init(frame: frame) printName() } } public class Cake: Shoes { } let cake = Cake() // this line prints 'Shoes' How do i make it print Cake , not Shoes ? Full