xib

iOS: Returning to main XIB from secondary XIB

回眸只為那壹抹淺笑 提交于 2019-12-11 06:28:40
问题 I am trying to change a back to the main xib after I was on a second XIB. This is the current code I am using: NSArray *nibObjs = [[NSBundle mainBundle] loadNibNamed:@"Results1" owner:self options:nil]; UIView *aView = [nibObjs objectAtIndex:0]; self.view = aView; I have a button on the second xib that returns back to the originating xib. When I hit the button the app crashes. I am not sure why because it does not display an error - it just crashes. Here is the code on the button on the

iOS - Cannot get an @IBDesignable .xib file to show up on storyboard or simulator

左心房为你撑大大i 提交于 2019-12-11 06:25:13
问题 I have set the file owner to be UserBannerView. The UIView in the storyboard that uses this .xib file is also set to be UserBannerView. I am not getting any errors, yet it won't show up in either the simulator or the storyboard. import UIKit @IBDesignable class UserBannerView: UIView { var view: UIView! @IBOutlet weak var userCreditsLabel: UILabel! @IBOutlet weak var userRenewDateLabel: UILabel! @IBOutlet weak var userImage: circlePP! @IBOutlet weak var userMembershipBtn: UIButton! @IBOutlet

Linking Label to IBOutlet gives NSUnknownKeyException

一世执手 提交于 2019-12-11 06:18:58
问题 I have created a TabBarView. On one of the tabs, I have a View with several Labels on it. It works fine. When I connect the Labels in Interface Builder to the File's Owner (the corresponding IBOutlets) then the App crashes with the following error when I open that tab: 2011-05-15 18:36:29.070 AeroNav[958:707] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x18afe0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for

Access files owner view controller instance from subclass (using SWRevealViewController)

纵然是瞬间 提交于 2019-12-11 05:19:34
问题 I am using SWRevealViewController (https://github.com/Joan-Lluch/SWRevealViewController) and am trying to access the revealViewController instance that lives within the files owner view controller of a xib file from within a subclass. Basically, in the files owner of the xib, i access the instance by saying [self revealViewController] and am able to control it that way. My issue is that I have a search display controller in the xib file and I need to access [self revealViewController] within

Autolayout resize UIButton with text and then the container view

微笑、不失礼 提交于 2019-12-11 04:44:30
问题 I am loading a view with buttons from a xib file. The button (green) has localized variable text. I need the UIButton to be resized dynamically with the text and then the container view (red) should be resized to the button size, so that container view does not have extra space. Since the whole container view should be horizontally middle in a view with a clear background and the text should not look like aligned in left or right. I have added background color to mark clearly :) Is it

iOS 6.0 AutoLayout issue with constraints: subviews disappear when rotated

人走茶凉 提交于 2019-12-11 04:28:19
问题 Hi I have designed a XIB using AutoLayout constriants to display two rows of buttons, with three buttons in each row, as shown in the screenshot (I'll place the buttons in the Red UIViews after I get a satisfactory layout): So far so good, in portrait mode as shown above the buttons look fine. However when I rotate to landscape the header (in blue) and parent view (in grey) resize and appear correctly, but the red button views just disappear (see below). What is the best way to set the

A few IBOutlets pointing to nil

心已入冬 提交于 2019-12-11 04:02:26
问题 After a long while I've finally started working with Objective-C again, on my only complete app so far. The goal is to eventually refactor for ARC and possibly storyboards, but for the time being I'm polishing the iOS 4.x target. I am quite rusty, so bar with me if this is a stupid question. I have a button in my main view that triggers the showAction method. The method is as follows: - (void)showAbout { AboutViewController *aboutView = [[[AboutViewController alloc] init] autorelease]; if (UI

The size of UIView/UIImageView on xib(Xcode8) become (1000, 1000)

雨燕双飞 提交于 2019-12-11 03:25:55
问题 I use autolayout on xib to create my UI. When I finish my UI. It work well on simulator. But when I open Xcode8 next time, the xib show strange. Some UIView and UIImageView become big. The size become (1000, 1000) Even so, when I run on simulator, it look well. But the xib cannot be modify easily. I try to update the frame. It become worse How should I deal with it? 回答1: It's Xcode8's issues. And that is fixed in Xcode8.1 beta2. Xcode 8.0 did not always restore view frames from storyboards

Subclassing a custom collection view cell created from a nib

自闭症网瘾萝莉.ら 提交于 2019-12-11 03:19:58
问题 I am struggling to figure out how to subclass a custom collection view cell that was created with a nib. Here is my setup: I have a custom collection view cell that is the superclass for all other collection view cells in my app, this view was created with a nib file. Now I want to subclass the custom collection view cell, and add more things again with a nib file. How do I subclass a cell created with a nib file? **I need to subclass a nib file and add to it with a nib file.***** Thank you :

How can I calculate the size of a UICollectionViewCell loaded from a xib with autolayout aspect ratio constraints?

心已入冬 提交于 2019-12-11 03:19:18
问题 I have a UICollectionViewCell that is loaded from a xib and stored in a property to help with calculating cell sizes for my collection view. The collection view always has only one column, so the cells vary in their widths based on the phone the user has (iphone 5/6/6+). The xib has an image view with an aspect ratio that must remain constant for all phone sizes. The problem I run into stems from this configuration. I cannot seem to make the cell size the way I want based on a fixed width. My