FAQ Database Discussion Community


Removing LaunchScreen.xib from a project

ios,sprite-kit,xib,launch-screen
Is it safe to remove LaunchScreen.xib from Xcode 6 project when is not used i.e. Images.xcassets is used instead ? What is the proper way to remove it ? There is a property in info.plist called Launch screen interface file base name with value LaunchScreen so I guess that should...

What is the correct way to use UIScrollView?

ios,objective-c,xcode,xib
I tried to setup a simple view which displays a text-only article with a headline. Here are the steps that I've done: Create View Controller with its .xib file, Create UIScrollView and places a UIView directly as the content wrapper, Set the constraints [scrollview]-0-[superview] in top, bottom, leading, and trailing....

Initializing a xib view as a subview of another NSView

objective-c,osx,cocoa,xib,nib
I'm trying to learn OSX development, and I've created a view in a .xib file, and I'm trying to initialize and then add this view as a subview. I've googled how to do this, and all of the solutions are for iOS and use a call such as MyViewClass* myViewObject...

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

ios,objective-c,autolayout,xib,uicollectionviewcell
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...

IBAction from Xib file to seperate View Controller

swift,action,xib
I am creating quiz application and when you scroll right or left it changes the question - I have a xib file for my custom scroll view that is linked to a UIView ViewController. However I have another ViewController which creates the scrollView. How do I get an action from...

Create a uiview xib and reuse in storyboard

xcode,uiview,autolayout,interface-builder,xib
I typically like to design my views in interface builder. Sometimes I need to create a single view in a xib that can be reused in multiple view controllers in a storyboard.

Custom view (xib) not visible on storyboard

ios,swift,xib,xcode-storyboard
I have a custom view xib where I have multiple TableViews. I am loading this inside a ViewController as a nested view: ViewController |_ View |_ View (This is where I load my Custom View) When I run my app, I can see the empty tables on screen, so my...

Asset catalog slicing using aspect fit

ios,xcode,xib,asset-catalog
I'm using slicing in the asset catalog to make my image stretch vertically, which seems to work fine if I have the view mode set to Scale to Fill But when I change the mode to Aspect Fit, it only shows the caps of the slicing like this I want...

Trying to load a nib from interface builder

ios,interface-builder,xib,initwithcoder
I have a UIView based class that has its own XIB. Lets call this class MyClass. So I have MyClass.xib, MyClass.h and MyClass.m. I have a UIView object on storyboard and I set that object's class to MyClass. I created a new UIView XIB and inside the XIB, I changed...

how to create xib subview at the center of tableview swift

swift,tableview,xib,subview,centralized
I have tableview and I created the custom xib uiview as "detailview" for it. I want to show this detailview at the center of scrolled area when tapped to tableview cell. I can show this view but cannot centralized it. when I set value to frame manually, subview will be...

Can't change the root view size of a xib file in code. iOS

ios,layout,xib
It is a topic that mentioned many times here but I can't find the solution for my case. I have disabled the "auto layout" property for the nib file, but in code, when calling self.UserInfoController.view.frame = CGRectMake(100, 0, 100, 100); only the first two paras take effect, that is, the...

Unhide Right Bar in xcode xib file

ios,iphone,xcode,xib
I am new to iOS development. I am not able to see the right bar form which we drag items to xib files.. How can i bring it back ? ...

Present XIB viewController with navigation bar (Swift)

ios,swift,xib
This is the code I'm using var xibvc = TestXibViewController() var navb = UINavigationController(rootViewController: xibvc) self.presentViewController(xibvc,animated: true, completion: nil) I'm tying to present xibviewcontroller with a navigation bar, It gives me this error reason: 'Application tried to present modally an active controller although, it works fine if i try pushViewController...

Display UIView while waiting for main view to load?

ios,objective-c,xcode,uiview,xib
So I am trying to create somewhat of a loading screen in my application. I have a view that takes 3-10 seconds to load. During this time I want to display a UIView that I made that is simply black with a loading screen. Currently I am putting my code...

How to instantiate NSViewController from a Framework on OS X (i.e. getting the correct bundle)

xcode,cocoa,xib,nsbundle,ios-frameworks
How can I instantiate a view controller from framework added to my OS X App (this may actually be the same process as iOS, I'm unsure, last time I looked Frameworks where not allowed on iOS but that may have changed)? Here is the setup: Private framework MyFramework.framework, containing a...

How to start from storyboard and modal to MainWindow.xib?

ios,objective-c,iphone,storyboard,xib
I have two projects, one starts from a storyboard and another is from MainWindow.xib. I want to combine them together, start from storyboard and click a button to launch the view of MainWindow.xib. What do I have to set? How should I modify the code? Please help, thanks a lot!!...

Custom UIView as navigationItem title

ios,uiview,interface-builder,xib,uinavigationitem
I want to create simple custom view and use it for navigationItem.titleView. My custom view is very simple, has only image view and label: [image]-[label]. I have xib file where I have defined all constraints (both subviews has constraint to superview - I want to height and width of subviews...

How do I instantiate a UIView / UITableView from a xib (nib) in a ViewController

ios,uitableview,swift,uiview,xib
I want to display a user interface that has a segmented control, and a different table view for each section of the segmented control; so, 2 table views (buddies and bunches) that can be switched between. To implement this, I have done the following Create a ViewController in Storyboard Delete...

Assigning Property to Loaded .xib

ios,cocoa-touch,interface-builder,xib
I'm attempting to alter the title of a button in a .xib I'm loading as: CustomToolBar *toolBar = (CustomToolBar *)[[[[NSBundle mainBundle] loadNibNamed:@"CoolBar" owner:self options:nil] objectAtIndex:0] initWithFrame:CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, 70)]; I've tried changing it directly using toolBar.button.titleLabel.text = @"VALUE"; And through a custom setter method, - (void)updateButtonText:(NSString *)buttonText { _button.titleLabel.text =...

Optimal way to support multiple iOS devices?

ios,design,graphics,storyboard,xib
I'm going to develop a simple app for iOS devices ( iPhone 4, 4S, 5,6,iPad ). I'm using native platform. In the previous days, I used to develop an XIB for each iOS device. Is this a good way? Thanks in advance...

Why is my popup view is empty?

ios,swift,xcode6,xib
I am trying to make a popup view similar to this one. What I have done so far is: Open a new single view project. Added a button to the main view. Added a new xib file named "popup.xib" Added a new swift file named "PopupViewController.swift" At the identity tab...

ios How to know which UIView when I click from xib?

ios,objective-c,xcode,uiview,xib
Because some reasons, I create a UIView xib file to reuse. How to know which UIView when I click from xib? I create a xib file extends UIView(named with XibView). Then I drag two UIView(leftView,rightView) in the storyboard, and set the custom class "XibView" in XCode inspector window. When I...

Necessary to Shift to IOS AutoLayout?

ios,objective-c,autolayout,xib,iphone-6
I have an app up and running which uses old iOS xib design methods of springs and struts. Each screen contains two xib files for iPhone 3.5 inch and iPhone 4 inch, all programmatic animations are slightly generically made such that they work on both resolutions. Since the introduction of...

mutilple labels in one row [closed]

ios,uitableview,xib
I want 4 to 5 labels like name,company name,short adress phone to be display in one single row in Uitableview as I am fetching data from restApi,So anybody know design how to do that . Thanks in Advance....

How do I get an objects height from awakeFromNib to my mainViewController.m?

ios,objective-c,xib,awakefromnib
I programmatically created a UILable in a xib file - class of awakeFromNib, and I'm trying to get the labels height in the mainViewController.m. I tried using an NSBundle to load the xib file, but it didn't work. Is there another way I should load it? I need to call...

Moving project from XIB/NIB to Storyboards

ios,objective-c,storyboard,xib
I have a project that I originally started working on in Xcode 4. I then moved this project to Xcode 6. The project compiles and runs swimmingly. I then wanted to move this to use Storyboards. Reading here and elsewhere I see people say they accomplished this by doing the...

Should optional views be added by storyboard/xib and then hidden or added programmatically? (Good practices)

ios,xcode,storyboard,xib
I'm starting a new project and I have some doubts about storyboard good practices, specifically about optional hidden views (show only under certain circumstances). Let's say you have an pdf downloader app, when the user select a download button a UIProgress bar appears and show the download progress. Should this...

Programmatically using constraints to center a UIIMageView

ios,objective-c,uiimageview,autolayout,xib
I'm working on an iOS project in which I need to programmatically use constraints for my views. I'm used to storyboards, but am using xibs for this particular project due to the nature of the project specification. I have a MainViewController, in which I create the following properties in the...

UITableViewCell's xib acting really strange

ios,uitableview,xib
I'm sorry for the ambiguous title, but I just can't find the right words to describe this. I have this xib, it contains one UITableViewCell, the UITableView has one subView(which is a simple UIView). AutoLayout is off. Both the UITableViewCell and its subView has the same width : 320. The...

IOS different xibs for different screen sizes

ios,uitableview,xib
I am new to IOS programming and would like to display a square image in a UITableViewCell, so size would be 320x320 or 375x375 for iphones 5 and 6 for instance. Can this be done with a single xib file or two different XIB? If it's 2 XIB, what is...

iOS: Loading second view controller without nib file

ios,objective-c,uiviewcontroller,uikit,xib
I have a project, which consists of the standard AppDelegate and ViewController files, but does not utilize nib files. Here's the code: delegate header // AppDelegate.h #import <UIKit/UIKit.h> @class ViewController; @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) ViewController *vc1; @end delegate implementation // AppDelegate.m...

Load UIView from XIB

ios,objective-c,uiview,xib
I'm looking for some advice on how to load UIView from XIB file. I tried following 5th solution from this tutorial. However, the button actions won’t work. I setup my project almost exactly as the tutorial, but the IBAction just won’t get called at all. I'm not sure if adaptive...

create custom unordered list from NSArray

objective-c,uiview,xib,addsubview
I'm trying to build a custom unordered list (with custom checkmarks as "bullets"). The data for this list is an NSArray containing NSStrings. My idea was to add multiple subviews (based on a xib file) to a UIView. The xib file has a UIImageView (checkmark) and a UIlabel (to set...

Custom UITableViewCell using xib

ios,objective-c,uitableview,xib
I have a custom UITableViewCell which links to a UITableVIewCell xib. When I run the app, I get an error. I did a lot of searching and I came up with this. When I try dragging from the cells view to the file owner, it seems like the view is...

Only white rectangle appears after adding a subview

ios,objective-c,xib,addsubview,loadnibnamed
I'm trying to add a subview with this code: NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"MenuView" owner:self options:nil]; MenuView *menuView = [subviewArray objectAtIndex:0]; [self.view addSubview:menuView]; But only a white rectangle appears, however with the correct size. (On the MenuView in the interface builder there are some elements, and it's background isn't...

Swift: Xib files Prefix Needed?

ios,swift,xib
I know Swift classes don't need to add prefix, but how about xib/storyboard files? For example: I have a RootViewController.swift and i want to create a xib file, should i name the xib file XXXRootViewController.xib or just RootViewController.xib is OK?

iOS Table View XIB layout issue

ios,xcode,uitableview,interface-builder,xib
I have declared x3 UITableView's in Xcode XIB interface builder: Then I ran current UIViewController in iPad Air iOS Simulator: As you see, top cell of the first UITableView view differs to second one / third one. Why is that so? How to make these UITableView'look like the same?...

How to set Hex color code in xib in iOS

ios,xcode,xib
I am not finding an option for Hex color code in xib color picker in xcode. But I have seen in stack over flow answer, http://stackoverflow.com/a/27283783/4391112. In this, image is having Hex color code option in color picker. Xcode version : 6.1.1 How can i get that hex color code...

Add a view defined in a xib file in a Window in the soryboard using Xcode & Swift

objective-c,xcode,swift,xib
I have a window in the storyboard and a box in defined a xib file. I would like to see the box appearing on the window as soon as the app launches. The box is also defined by a custom cocoa class that I created and I associated to the...

Is it bad practice to put UIViewControllers in other UIViewControllers?

ios,iphone,uiviewcontroller,xib,subview
I know there is the common practice in iOS development of having one UIViewController presented on the screen whose view is loaded from a XIB which will contain all the UIView subclasses in it. While I was working on a pretty complex widget for an app, I decided to make...

One xib, multiple classes without inheritance in iOS?

ios,objective-c,xcode,xib,nib
I have two classes and one xib. I can't simply use one parent class which will be linked with this xib because it means multiple classes (and of course it is not acceptable for me to insert an object of one parent class into the object/class of the another one)....

Calling awakeFromNib from xib file in the main ViewController

objective-c,uitableview,xib,custom-cell,awakefromnib
I have a custom cell in a UITableView using an xib file. I programatically created a UILabel with a height of 200 and a width of 50. When I do an NSLog in the customCell.m of the label's width and height, it gives me w: 50 and h: 200. But...

Xcode 7 beta made my apps storyboard files inaccessible

interface-builder,xib,xcode7
I installed the Xcode 7 beta 1 and it asked me to convert my code to Swift 2, which I did. All worked fine, there were only some problems with my apps test target. When that was solved, I built and ran the app and the error said: com.apple.interfacebuilder error...

Align two labels in a table cell?

ios,interface-builder,xib
I am having pretty crazy amounts of issues trying to align two labels inside a table cell: The problem is I need both labels (the region is clickable) to be centred within their cell. I can only seem to get the layout centred based one or the other. Is this...

Swift - unwanted margin in xib

ios,xcode,swift,autolayout,xib
So I have some strange margins to the left and right of my app: Here is one xib: And here's another xib from the same app: And here's the corresponding views from XCode (6.1.1): and Does anyone have any thoughts about how I might fix this? I suspect my UINavigationController...

Wrong width of custom section header form xib

ios,iphone,uitableview,autolayout,xib
I can't manage to make the view's width adapt to the size of the table view on different screen sizes Here's my code on viewDidLoad() view.tableView.registerNib(UINib(nibName: "Header", bundle: NSBundle.mainBundle()), forHeaderFooterViewReuseIdentifier: "Header") And on the Table View Delegate: func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { var cell = tableView.dequeueReusableHeaderFooterViewWithIdentifier("Header")...

Swift - Assign a NIB to self in class

ios,swift,subclass,xib,init
I am creating a UIView subclass for a notification dropdown banner. I am using a XIB to build out the view and want to assign that xib to the class when it initializes (i.e. avoiding having to do this from the calling ViewController). Since you can't assign to 'self' in...

UIView background color with alpha in xib

objective-c,xcode,xib
I have a problem. I am trying to make my custom UIView with an image in the very center. The part outside of that image got to be transparent and grayed. In xib for "View" I've set this: The result - fail. The region outside the image is just gray,...

UIPopViewController not working

ios,objective-c,xib,uipopovercontroller
I have an xib file with a .h and .m linked. In the xib there is a UIView with a textView. What I would like to do with that view is open it as a UIPopViewController when you click a button. Here is my code: - (IBAction)thisButton:(id)sender { popViewController *popVC...

How to Call awakeFromNib in mainViewController.m

objective-c,uitableview,xib,custom-cell,awakefromnib
I have an xib file containing a custom cell. I'm trying to access the height of an object created in customCell.m. Here is my code: customCell.m - (void)awakeFromNib { self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 200)]; [self.label setText:@"This is a label"]; [self.myView addSubview:self.label]; NSLog(@"%f", self.label.frame.size.height); // Results: 200.0000 }...

How to call a XIB and return to the calling XIB?

objective-c,iphone,xib,xcode6.1,ios8.1
I have an app with two (2) XIB files; one is the main view, the other is a help view. I have view controllers created for both. I have a button on the main view XIB that calls the help view which works like this: - (IBAction)bDisplayHelp:(UIButton *)sender { HelpViewController...

Custom System of templates on iOS

ios,objective-c,swift,storyboard,xib
I want to use some different templates (say like 5, and can grow after) for every viewController in my App. There are some different approaches I can think of: 5 different storyboards repeating the same navigation in each of them. Since the app may/would change, I'm discard this option since...

Loading UIViewController “from” Nib File

ios,xcode,uiview,uiviewcontroller,xib
I am trying to create an UIViewController from a Nib file. On Google I found that I can only load an UIView from Nib. But some suggests that I could create a Nib file (of UIView) whose File Owner is set to our ViewController. That is what I did, I...

Custom UIViewController's view is not being shown

ios,swift,uiviewcontroller,xib
So i have this view controller and it has a xib file, i checked for File's Owner and also the view outlet, both class and xib files are connected. But if i want to push this view controller it will show an empty one even if all its methods are...