xib

How can you switch localized Nibs within an app?

喜夏-厌秋 提交于 2019-12-24 15:53:31
问题 My requirement is to switch localized XIBs from within the app. Usually when you localize a XIB and change the language from Settings, the specific language localized XIB gets loaded automatically. I have XIBs like in the below image: I want to load the XIB when the specific language is selected on a button tap within an application. Source code for such an application can be found here. How can I do this? 回答1: I solved the problem by creating a simple method see below -(void

Custom UIView from XIB has no height in UIStackView

为君一笑 提交于 2019-12-24 15:24:50
问题 I am adding a custom UIView to a UIStackView inside a UIScrollView. The custom UIView is created from a XIB without a fixed width. I use autolayout to horizontally constrain the custom view to the UIStackView. All the subviews in the custom view have either a fixed height or an intrinsic height (i.e. labels). When I add the UIView to the UIStackView, they pile on top of each other, as if they have no height. How do I ensure the correct height of my custom view inside the stack view based on

Turning off “Use Autolayout” causes app to only run in portrait mode

不想你离开。 提交于 2019-12-24 13:30:24
问题 I want my app to be compatible with iOS 5, so I had to disable "Use Autolayout" in the XIB files. The whole app is designed to be run in landscape mode. When the app is launched after disabling autolayout (whether in iOS 5 or iOS 6), the app always launches in portrait mode and refuses to rotate to landscape. In Info.plist, Supported Interface Orientations (iPad) is set only to landscape. What am I doing wrong? This only occurs after disabling autolayout. 回答1: I was able to fix the issue in

rename xib file

给你一囗甜甜゛ 提交于 2019-12-24 11:12:43
问题 I started to create an app using tabbar app template provided in xcode. Then I wanted to change the names of the files: FirstViewController should become YellowViewControler and FirstView.xib should become YellowViewcontroller.xib. Changing the name of the xib wasn't done right. It became red as if it didn't exist in the project. So: how should I change the name of the xib files? 回答1: Use the "Refactor" tool of Xcode. This will manage the renaming of the XIB file, the renaming of the

Sequence of execution when loading xib?

余生长醉 提交于 2019-12-24 07:23:03
问题 I have been programming on iOS for almost six months now, using xibs left and right, but i am still unaware how loading process works... What i mean, i have view controller and push button to open new modal view controller. From that point onwards how are things done. Is init method first called, then xib created, outlets connected and then nib loaded? Is there any good article or book that explains this in details? 回答1: Give this article a look: The View Controller Life Cycle 回答2: this maybe

Sequence of execution when loading xib?

点点圈 提交于 2019-12-24 07:21:40
问题 I have been programming on iOS for almost six months now, using xibs left and right, but i am still unaware how loading process works... What i mean, i have view controller and push button to open new modal view controller. From that point onwards how are things done. Is init method first called, then xib created, outlets connected and then nib loaded? Is there any good article or book that explains this in details? 回答1: Give this article a look: The View Controller Life Cycle 回答2: this maybe

Sequence of execution when loading xib?

大兔子大兔子 提交于 2019-12-24 07:21:10
问题 I have been programming on iOS for almost six months now, using xibs left and right, but i am still unaware how loading process works... What i mean, i have view controller and push button to open new modal view controller. From that point onwards how are things done. Is init method first called, then xib created, outlets connected and then nib loaded? Is there any good article or book that explains this in details? 回答1: Give this article a look: The View Controller Life Cycle 回答2: this maybe

Difficulty Accessing UITableViewCell Created in Interface Builder .xib File

我与影子孤独终老i 提交于 2019-12-24 00:17:25
问题 In my UITableView, for the last row of the last section of the table, I load a special UITableViewCell that is different from all the others on the table. I created the cell in my .xib file and gave it the reuse identifier "endCell." I would think that I could just do the following to access my cell: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if ((indexPath.section == [sections count] - 1) && indexPath.row == [[sections

Are Images assigned in a xib cached?

让人想犯罪 __ 提交于 2019-12-23 23:31:14
问题 If I assign an image to a UIImage view in a xib, is that image cached so that if I access the image using UIImage imageNamed: I am getting cached Image data? I'm using iOS 5.1 回答1: UIImage imageNamed: does its own cacheing of any images you use. The first time you use it for a given image, it'll populate the cache, and subsequently it'll use the cached version. UIImageView in Interface Builder takes a string to tell it what image to use. It appears that the object that is actually encoded in

Load a nib file to act as a custom keyboard when a UITextField is tapped

余生颓废 提交于 2019-12-23 17:59:54
问题 I'm trying to load a .xib file to act as a custom keyboard when a textField is tapped. I'm able to show the .xib file (view) when the textField is tapped but I'm not sure how to communicate the buttons in the .xib file with the a textField in the ViewController.swift . This is what I have done so far. Created a single project. Added a UITextField and created an outlet for it. @IBOutlet weak var myField: MyTextField! Created a new .xib file and called it CustomView.xib . Created a new class