xib

Perform Segue from Xib programmatically

ε祈祈猫儿з 提交于 2019-12-07 18:50:28
问题 I've search a lot but I can't do yet. I've my .xib UI with some buttons, separated from main storyboard. I need to perform an action when I press one of this button and show another view. How can I do this directly from code such ad inside an IBAction? 回答1: You can't perform segues from XIB to Storybaord, Instead of it you need 1) Get Storyboard's instance. 2) Instantiate a ViewController that is inside the Storyboard (By using Storyboard ID). 3) Push that ViewController to to your navigation

How to write init method for custom UIView class with xib file

怎甘沉沦 提交于 2019-12-07 17:13:57
问题 I have created simple view using interface builder. This view has one label. Do you know how to create init method for this class ? I wrote my own version but I am not sure that it is correct or not. @interface AHeaderView () @property (nonatomic, weak) IBOutlet UILabel *descriptionLabel; @end @implementation AHeaderView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // add subview from nib file NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@

Slider view for iOS

别说谁变了你拦得住时间么 提交于 2019-12-07 16:56:12
问题 Can someone help me with this scenario? *There is a button, which when tapped, slides opens up a UIView, with the tapped button still to its left. *This button when tapped again, makes the UIView slide back. 回答1: What you describe is easy. Let's call the view that slides in from the right a drawer ("drawerView"). Set up the drawer view as a child view of your view controller's main view. Make that "drawer" view a container view. Put everything you want inside it. (Your text view, buttons, etc

Best approach to change Xib direction programmatically

岁酱吖の 提交于 2019-12-07 12:03:59
问题 I have an app that has a settings page in which the user can change the app's language. Eventually, the direction of the xibs will change. To explain a bit more, if the language is English for example, the direction will be LTR; However if it's Arabic, it will be RTL. Question What is the best approach to achieve this? Approaches tried with issues NSUserDefaults : When setting the language to "ar-SA", the direction changes successfully but only when it's called in the main class. When I do it

Performance penalty for using NIB files?

本秂侑毒 提交于 2019-12-07 07:59:05
问题 I am curious to know if anyone has any experience comparing the load time performance of iPhone apps with views laid out in NIBs vs. views laid out entirely programmatically (i.e. instantiating UITextView, adding it to the view, instantiating UIButton, adding it to the view…). If I want a simple app to load lightning fast, would it be better to forgo using a NIB (well, XIB technically) and instead create view elements programmatically? Is the time spent loading and parsing a NIB sufficient

Adding constraint to the “main view” in a xib

佐手、 提交于 2019-12-07 03:47:58
问题 I have a UIView defined in a .xib file. I need to set translatesAutoresizingMaskIntoConstraints = NO . This means that the frame is not translated to constraints so I need to set the size constraints by myself. I have created a working category method for a UIView : -(NSArray*)setSizeConstraints:(CGSize)size { NSLayoutConstraint* height = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:0 toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1

xcode storyboard - ibtoold unarchiving exception

筅森魡賤 提交于 2019-12-07 03:38:55
问题 the exception is; CompileStoryboard Catwall/en.lproj/MainStoryboard.storyboard cd /Users/guvenozyurt/Desktop/git/catwall_ios setenv IBSC_MINIMUM_COMPATIBILITY_VERSION 5.1 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" setenv XCODE_DEVELOPER_USR_PATH /Applications/Xcode.app/Contents/Developer/usr/bin/.. /Applications/Xcode.app/Contents/Developer

Why does my XIB file not localize (iPhone)?

▼魔方 西西 提交于 2019-12-06 23:22:56
问题 Situation: I am starting XCode, creating a new project for the iPhone (view application) and loading the XIB file into the IB. I manipulate the view (adding a label with the string "hello"), save, build, run the application, everything is fine. Now i am localizing the XIB. What i do: right-click on the xib-file, adding the desired language and after that, i have two XIB files in my XCode. Looks absolut perfect, just as it is shown in my iPhone Programming book ("the big nerd ranch"). I do

Transitioning from XIB files to Storyboard

馋奶兔 提交于 2019-12-06 18:21:27
问题 I currently have an XCode project that uses XIBs and would like to start using Storyboards. Is there a good way to move my XIB files into the Storyboard? 回答1: You can do this manually one view controller at a time. Copy the view from xib (⌘ c). Go to storyboard and create a new view controller in it. Then select the view of that view controller and hit paste (⌘ v). 来源: https://stackoverflow.com/questions/7798400/transitioning-from-xib-files-to-storyboard

Why doesn't initWithNibName work for my UIViewController subclass?

六月ゝ 毕业季﹏ 提交于 2019-12-06 18:05:36
问题 I have subclassed UIViewController into a new class, PageViewController (I'm writing a simple book app). I want to add a new view loaded from a nib file and am using the following code. It works. PageViewController *viewController1 = [[UIViewController alloc] initWithNibName:@"Page1" bundle:nil]; [viewController1.view setUserInteractionEnabled:YES]; [self.view addSubview:viewController1.view]; However, the first line is wrong because I should be calling alloc on PageViewController. When I