Embed the labels in a new view, then centre that view with autolayout. Also, let this new view resize itself according to the labels So: - Add leading and trailing constraints between labels and their superview (new view) - Centre the new view in the UITableViewCell I just got home,...
xcode,interface-builder,autolayout
Yes, using the ibtool command: ibtool /path/to/your.xib --write /path/to/new.xib --update-frames ...
xcode,uiview,autolayout,interface-builder,xib
Works in Xcode 6.3.1 Create a new UIView named 'ReuseableView' File > New > File > Source > Cocoa Touch Class > UIView Create a matching xib file named 'ReuseableView' File > New > File > User Interface > View Set the file owner of the of the xib select...
ios,xcode,xcode6,interface-builder
I'll try to explain the concept of constraints and storyboard representation. Constraints - are used to determine the position of UIView elements inside your view. For example, the vertical distance from top of the view to UIView element top. When you add constraint using the storyboard it plays 2 roles:...
cocoa,interface-builder,nstableview,selecteditem,nsoutlineview
Instead of checking the selectedRow of self object, which is just a object initialized in AppController which is a wrong instance. You need to check on the notification object as shown below. NSLog(@"Selected Row:%ld",[[notification object] selectedRow]); Also clickedRow is meaningful in the target’s implementation of the action. So the clickedRow...
swift,xcode6,interface-builder,scenekit
I did some extensive testing, and I believe this is a bug. The IB property all work, besides the scene one. If you remove all the code in GameViewController.swift you will see the background is red, as you defined it in IB. I created a bunch of new projects, in...
ios,iphone,cocoa,interface-builder,nsformatter
The NSFormatter class is an abstract class, so you need to subclass it. On that you need to implement the following methods. - (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error; - (NSString *)stringForObjectValue:(id)obj; - (BOOL)getObjectValue:(out id *)obj forString:(NSString *)string errorDescription:(out NSString **)error; Create a subclass like: .h @interface MyFormatter : NSFormatter...
Yes, you can create and edit a palette in IB and then share it with your team This article has all the details: http://natashatherobot.com/xcode-color-palette/
ios,arrays,swift,interface-builder
So, you want to autolayout programatic buttons. First question is... are you getting these to lay out at all? Are they appearing in the view in any shape or form? If not, then your issue not an autolayout one, but rather, just an issue of adding them to the view...
One easy way to get the same effect, but not answering exactly your question, is to disable UITableView's separators and adding a 1px-height UIView to the prototype cells you want to have it.
ios,uitableview,swift,interface-builder,uibarbuttonitem
You simply misconfigured the UIbarButtonItem/UIButton in Interface Builder's Attributes Inspector. There is no point to waste time investigating such a trivial issue, no matter how puzzling it may seem. Just delete that Start button and drop a new one into the toolbar again. There is no reason for it to...
ios,autolayout,interface-builder,nslayoutconstraint,size-classes
The problem is that constraints are not fully defined yet until Layout events happen between -viewWillLayoutSubviews and -viewDidLayoutSubviews where all the parameters from IB comes into play. My rule of thumb is: if you use frames to position your views manually you can do it as early as -viewDidLoad, if...
ios8,interface-builder,ibdesignable
I will answer my own question so that other people may benefit. You can use User Defined Runtime Attributes to call a category method to set your IB_Designable object from the outside. IB_DESIGNABLE @interface DesignableLabel : UILabel @end @implementation DesignableLabel @end @implementation DesignableLabel (Runtime_TheTextYouWant) - (void)setTheText:(BOOL)b { if (!b) return;...
ios,objective-c,xcode,interface-builder
You can create a property on your View Controller class and wire it up by control + clicking on the cube. So in your header file, create something like: @property (weak) IBOutlet MyObjectClass *myObject; ...
osx,swift,interface-builder,nstableview,nsview
I think TableCategoryView is your new class and it is subclassed from NSView and shall replace the NSTableCellView you get when creating (in IB) a view based NSTableView. If you really want to create your own TableCellView it should be a direct subclass of NSTableCellView not NSView. But in your...
ios,uitableview,swift,interface-builder
Couldn't find a way to do it inside the interface builder but I have solved it by choosing the "dynamic prototypes" for the UITableView content and then in the UITableViewController added this: override func numberOfSectionsInTableView(tableView: UITableView) -> Int { return N // number of required sections } Now I can...
ios,uiview,interface-builder,xib,uinavigationitem
In your custom view, override the layoutSubviews method and add this: CGSize targetSize = [self systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; Create a CGRectFrame from this and set this frame as a new frame for self (which is the custom view). This will basically find the smallest possible frame that still encompasses its content in...
ios,objective-c,interface-builder
EDIT* - This is actually caused by the app's deployment target being set as iOS7. When I switch to ios8, the problem goes away. Sounds like you need to update your app to properly support iPhone 6/6+ screen sizes. One of my apps has this problem. You'll need to go...
swift,interface-builder,watchkit,wkinterfacelabel
Set your Group to fit content. Your Group is hiding you label display.
osx,swift,cocoa,interface-builder,nstextview
NSTextView inherits from NSText. NSText has a baseWritingDirection property. Try setting that: hebrewTextView.baseWritingDirection = NSWritingDirection.RightToLeft It also inherits the action method makeBaseWritingDirectionRightToLeft() from NSResponder, which presumably what the contextual menu uses. So, you could call that. If neither of those works, you can set the text view's defaultParagraphStyle to one...
ios,uitableview,interface-builder,uinavigationbar,uistoryboard
You have to choose your first view controller and from top menu you must select Editor -> Embed In -> Navigation Controller This is how you add Navigation Controller to a View Controller. Also you have to use delegation for passing data back from the pushed view controller. ...
ios,uitableview,uibutton,interface-builder,uistoryboard
From the apple docs of titleLabel Do not use the label object to set the text color or the shadow color. Instead, use the setTitleColor:forState: and setTitleShadowColor:forState: methods of this class to make those changes. Similarly for text you should use setTitle:forState: [sender.titleLabel setTitle:@"Clicked" forState:UIControlStateNormal]; ...
ios,xcode,uiview,uinavigationcontroller,interface-builder
To solve this issue, I used the view debugger to capture the view hierarchy of both another navigation push segue that was working properly and this one. This showed me that the black rectangle area was reserved for showing a UIToolbar. Since you can't hide or show toolbars currently using...
ios,iphone,xcode,uiview,interface-builder
You have not add subview when you call init,and you forget to set frame of your view in xib. so you may change your code to this and try. #import "CostcoLoginView.h" @implementation CostcoLoginView -(id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if(self){ [self setup]; } return self; } -(id)initWithCoder:(NSCoder *)aDecoder{ self=[super initWithCoder:aDecoder]; if(self){...
cocoa,interface-builder,nsdatepicker
On OS X 10.9.5, class-dump shows that NSDatePicker overrides -rightMouseDown: (as well as -rightMouseDragged: and -rightMouseUp:). I'm guessing it doesn't call through to super and so is (accidentally?) blocking the contextual menu. First, does right-dragging in a date picker do something unique? I've not been able to see it, but...
ios,swift,interface-builder,autolayout,uinavigationbar
Try one of the following: Use self.edgesForExtendedLayout = UIRectEdgeNone; in your view controller's -viewDidLoad method. This will translate the origin.y to the bottom of the nav bar. Add a constraint in your view controller that makes the LocationPermissionsInfoView's view to respect it's topLayoutGuide. Since you are adding the view programmatically,...
objective-c,xcode,cocoa,interface-builder,nssplitview
Try connecting the view outlet of the NSSplitViewController to the NSSplitView - this worked for me in a simple sample project. If no-one comes along with a better answer, I'd consider filing this behaviour as a bug using Apple's Bug Reporter - either this connection should be configured by default,...
xcode,interface-builder,xcode6
Frames describe where to place views on the screen and how big those views will be. When laying out views, constraints use a related geometric element called an alignment rectangle. The alignment rectangle is based on the presentation of the item’s content, Auto Layout uses the alignment rectangle instead of...
ios,interface-builder,autolayout
Select all of the squares and apply Equal Widths and Equal Heights constraints to them all. Then, for one of the squares, apply an Aspect Ratio constraint to keep its width and height equal to each other. Finally, add a single space constraint between any two adjacent squares. Those along...
As of Xcode 6, Apple has distinguished classes from other kinds of file. You want to go command+n -> Cocoa Touch Class and follow through there. Unintuitively, Apple does not offer the ability to create an Objective-C class within the 'Objective-C File' template.
ios,swift,interface-builder,autolayout
Programmatic intervention is required: UITableViews are of course UIScrollViews, and nested scrollviews aren't going to be able to size themselves in AutoLayout. It's a legitimate ambiguity, because AutoLayout won't know to make the frame smaller and require more scrolling or the frame bigger and less scrolling. In your case, you...
You can use UIBarButtonItem with a custom view. You can do that in a storyboard/xib just by dragging and dropping a view/button to your toolbar and it will create a UIBarButtonItem with the nested view. The code will look like this: <barButtonItem style="plain" id="AwC-sg-sT1"> <view key="customView" contentMode="scaleToFill" id="4Z4-cp-rPM"> <rect key="frame"...
objective-c,osx,cocoa,interface-builder,nsoutlineview
Step 1: Create an NSTableViewRow subclass The borders are drawn on the NSTableRowView instances that make up the table's rows. To get them, you could subclass NSTableRowView and give it a borders property that stores a mask specifying which borders you want drawn on the row. You'd accompany this with...
ios,xcode,uitableview,ipad,interface-builder
for iPad write down your code i.e. UIView *customColorView = [[UIView alloc] init]; customColorView.backgroundColor = [UIColor colorWithRed:0.15 green:0.40 blue:0.60 alpha:1.0]; cell.selectedBackgroundView = customColorView; in willDisplayCell delegate. I think This will helps you....
ios,xcode6,interface-builder,autolayout
set the three views to have an equal width set view1's leading constraint to superview to have a constant of 0 set view1's trailing constraint to view2 to have a constant of 0 set view2's trailing constraint to view3 to have a constant of 0 set view3's trailing constraint...
ios,swift,interface-builder,iboutlet,uicontrol
Off-course you can't add IBOutlet because buttons what you added to WeekdayControl are in UIViewController, you can't add Outlet to WeekdayControl, buttons only subviews of WeekdayControl, UIViewController is boss here, and you can add outlet only to UIViewController. (Sorry for my English) Better create you buttons programatically in WeekdayControl....
See -[NSResponder cancelOperation:], which is automatically bound to the escape key: This method is bound to the Escape and Command-. (period) keys. The key window first searches the view hierarchy for a view whose key equivalent is Escape or Command-., whichever was entered. If none of these views handles the...
ios,swift,uitableview,autolayout,interface-builder
First of all remove all constraint from that three label then follow this step and add constraint one by one as mentioned below. For Left Label select your label go to pin menu the add this 5 constraint for it.: For center label add this two constraint so it will...
ios,ios8,interface-builder,nslayoutconstraint
One option is to make the answers live in a UITableView and then each answer is just a cell and you can do it all in Interface Builder. A second option, if you know you'll never have more than 8 answers, is to put all eight UILabels and set unused...
ios,iphone,interface-builder,xcode6
This happens when you set "size classes" incorrectly. For example, when you design a controller with a specific size class set and then you change the class to a different one.
None of the fonts that are provided with iOS include a glyph for that character. If you visit this test page in MobileSafari, you will also see it rendered as a fallback square. In order to have this character rendered correctly, you will need to supply a font with your...
ios,xcode,interface-builder,uistoryboard
Clean the project and delete the app on simulator.
ios,interface-builder,xcode-storyboard
You are looking at what happens when you have designed your views in a particular size class and then, when you look at the storyboard, you are not in that size class. For example, let's say you happened to be in size class H:Regular W:Compact when you put "top line"...
ios,xcode,storyboard,autolayout,interface-builder
As the view at the bottom has a fixed height...you just need to pin all edges of the all views and just need to give equal width constraints to the black and green views...just like below image... And the output in different screens... ...
xcode,interface-builder,uicollectionview,uitextview,offset
The answer turned out to be turning off "Adjust Scroll View Insets" on the ViewController. Sort of a weird behavior for the ViewController to present like that, adjusting a single ScrollView without any regard for its position or size, but at least it was an easy fix. ...
ios,objective-c,swift,storyboard,interface-builder
Figured it out! You just need to edit the MODULE in the interface builder to the name of the project!!...
For UIScrollView and its subclasses (UICollectionView, UITableView), setting the contentInset to something like, say, UIEdgeInsetsMake(64.0 /* TOP */, 0.0 /* LEFT */, 44.0 /* BOTTOM */, 0.0 /* RIGHT */); would be the way to go. You can inspect the UIViewController's properties topLayoutGuide and bottomLayoutGuide to determine how much you...
ios,objective-c,uiscrollview,interface-builder,uistatusbar
From Documentation A Boolean value that indicates whether the view controller should automatically adjust its scroll view insets. Declaration @property(nonatomic, assign) BOOL automaticallyAdjustsScrollViewInsets Discussion Default value is YES, which allows the view controller to adjust its scroll view insets in response to the screen areas consumed by the status bar,...
If you want to show different different view controller on each different cell in tableView in ur case ie. category. Add view controllers in Your story board. Add add segue to each controller from table view. not from cell. set identifier to each segue . After this u can call...
ios,swift,interface-builder,uicollectionview
Answered in comments. Calling self.performSegueWithIdentifier("yourSegueIdentifer", sender: self) fixed it.
xcode,swift,cocoa,interface-builder
I dont know if this is correct way of doing, but this will solve your problem. Decalre a NSWindow property in AppDelegate weak var window: NSWindow! and set the property in something like windowWillLoad of the NSWindowController (NSApplication.sharedApplication().delegate as! AppDelegate).window = self.window You will have to subclass NSWindowController to define...
xcode,core-data,interface-builder,cocoa-bindings
So I have the answer from Apple. This is for Document based Core Data apps, the code is all in Swift but the idea is the same in Objective-C you just have to translate it. The first answer they gave me was to bind the array controller to the view...
ios,xcode,uitableview,interface-builder,xib
ok, i got it. override the init method like the following: - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.automaticallyAdjustsScrollViewInsets = NO; } return self; } you have to take care of the insets yourself since this automatic property can only handle the inset...
ios,xcode,interface-builder,autolayout
I haven't been able to find an official explanation as to why XIBs behave like that, when they have a UIView at the root. What looks weird to me is that what we are provided with as a default (LaunchScreen.xib) isn't set up to behave exactly like the Storyboards we've...
ios,xcode,uitableview,interface-builder
You can add some transparent views to the superview, and use them as spacers. I thought this was weird at first, but I noticed that Apple recommends it (it even turns up as a suggestion in one of their amazingly informative NSLayout debug messages) [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @"H:|[spacer1][view1]\ [spacer2(==spacer1)][view2]\...
ios,cocoa-touch,interface-builder,xib
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)]; Your code makes no sense. You cannot / must not init an object loaded from a nib; it has already been initialized. I suggest you take that statement apart into several steps and make sure...
ios,xcode,interface-builder,autolayout
There are a number of ways you could create this layout with constraints. Here's one. First, a tip: you can name your views in the document outline. This makes it much easier to understand which views are which and what your constraints are connected to. To name a view, click...
ios8,xcode6,interface-builder,google-plus-signin
The problem was that it was giving the issue of duplicate files, that were present in Bolts.framework and FacebookSDK.framework both. After that I found out that FacebookSDK.framework was not needed there and so I removed it and the app started working perfectly.
ios,xcode,storyboard,autolayout,interface-builder
The views only show up that make sense for the direction you chose. So, if one view is above another, and you choose the left or right constraint, the other view does't show up. If you choose the top constraint, it should. Another way to do this is to control-drag...
yearView.frame = CGRect(x: 0, y: height - 250, width: self.view.frame.width, height: 250) Try moving it out of the ViewDidLoad, you need to position that view whenever you unhide it, otherwise it will not show. ...
cocoa,interface-builder,nswindow
In the IB , you can find a check box named "Visible at Launch" in attributes tab. You can uncheck that.So that window will not launch on app loading time
Just delete that connection by renaming the -(IBAction)XXX to -(IBAction)YYY & replace the name to YYY from where you are calling it in selector. And hope it will solve your issue. Happy Coding...
cocoa,swift,interface-builder,autolayout
Because you aren't adding any constraints to your box in Interface Builder, at the point it loads it is considered to have an ambiguous layout. To remove this ambiguity, Cocoa automatically adds some constraints: override func viewDidLoad() { super.viewDidLoad() println(view.constraints) //-> <NSIBPrototypingLayoutConstraint:0x600000082e40 'IB auto generated at build time for view...
ios,objective-c,xcode,interface-builder,autolayout
Select the constraint you want to disable in storyboard, and Option+Command+4 to show Attributes Inspector, then unselect Installed.
I fixed this by reinstalling Xcode 6 and unfortunately by changing Swift 2 elements back to Swift 1, I didn't back up. Then I deleted every Nib or Xib file in the project, but I did copy them separately in an other map. I could open these files, and copy...
ios,uitableview,swift,storyboard,interface-builder
--> incredibly after a complete reboot of my Mac now everything works and I can set my custom class. Really strange but I decide to reply to my post, maybe can be helpful for someone else....
swift,ios8,storyboard,interface-builder,scene
The only way I got around this was to use two Done buttons on the date picker scene because one button cant have two unwind methods. So when i segue from one scene to date picker scene I send a boolean in prepare for segue. In date picker scene I...
You can not set some properties of a view's layer through interface builder. You can set a layer's borderWidth and cornerRadius via Interface Builder tool of Xcode, but you will not be able to set borderColor using Interface Builder and it's probably because the layer.borderColor wants a CGColor instead of...
xcode,cocoa,interface-builder,appkit,nsbutton
If those are really NSButtons, then open the xib in Xcode, click on the button, go to the "Attributes" pane, and change the "Type" of the button to "Push On Push Off". That makes it "sticky".
xcode,osx,swift,interface-builder
Create a class that implements the protocol NSTextFieldDelegate like class MyTextField:NSTextField, NSTextFieldDelegate { override func awakeFromNib() { delegate = self // tell that we care for ourselfs } override func controlTextDidChange(obj: NSNotification) { // .... handle change, there are a lot of other similar methods. See help } } In...
ios,interface-builder,autolayout
Add a view between your buttons. Give it a clear background and pin it on the left and right to your buttons with a constant space of 0. Add your line view to this view and center it horizontally in its containing view. ...
You should check size class here,I think that your old project is build for a size class and you view it on another ...
ios,uitableview,swift,interface-builder,uistoryboard
You should add auto layout constraints. In storyboards, you can add auto layout to make the button stay on the right like this: I used a switch to demonstrate. 1) Select the "Button". 2) Click the icon on the bottom circled in red. 3) Constrain the space between the superview...
ios,xcode,interface-builder,nslayoutconstraint
According to the documentation, relation is read-only. What you will need to do, I suspect, is to set self.myConstraint.active = NO; Then make a new NSLayoutConstraint programmatically using: + constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant: And in the process copying values you want to keep, and replacing the relation. Then add it to the view...
ios,xcode,uiimageview,interface-builder,autolayout
You need to set an Aspect Ratio constraint for the image so that Xcode knows how large it will be
The scrollability (is that a word?) of a UIScrollView depends upon its contentSize in relation to its bounds size. The idea is to make the contentSize embrace the content; if it is bigger than the scroll view's bounds size, the user can scroll. Your code doesn't set the contentSize anywhere....
objective-c,storyboard,interface-builder,watchkit,apple-watch
I've struggled with the same issue for several hours until I decided to give it up for a while and focus on filling the labels with actual data at runtime. After I added some code to the main initialisation methods of WKInterfaceController ((void)awakeWithContext:(id)context {} and/or (void)willActivate {} ), this scrolling...
swift,interface-builder,xcode6
first set table view 1.set separatorInset of tableview instance to UIEdgeInsetsMake(0, 0, 0, 0) second set cell 1.set preservesSuperviewLayoutMargins of cell (instance) to NO 2.set layoutMargins of cell to UIEdgeInsetsZero 3.saet separatorInset of cell to UIEdgeInsetsZero Hope to help you...
ios,interface-builder,watchkit
You can't, because for WatchKit they are Interface Objects instead of Views. Apple intentionally uses different terms for them because they are fundamentally different things. Interface Objects are proxy objects to those actual views in the actual watch app (not your WatchKit Extension). They communicate through WatchKit via Bluetooth to...
ios,interface-builder,uislider
Seems like this is a bug in interface builder. I'm using Xcode 6.3.1 and was able to reproduce this as well. Min Track Tint and Thumb Tint work, but Max Track Tint has no effect when running on device.
ios,user-interface,interface-builder,xcode-storyboard
You can set custom title view to the navigation bar like this way. //To hide default back button self.navigationItem.hidesBackButton=YES; //Title View for Navigation UIView *navTitle1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)]; [navTitle1 setBackgroundColor:[UIColor lightGrayColor]]; //Left View button and separator UIButton *crossBarButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; [crossBarButton...
ios,swift,autolayout,interface-builder
Rintaro's answer was very detailed and helpful, but it wasn't working for me exactly how I wanted. It would work as far as keeping the view a certain minimum height, but it was also cutting off the label at a static height. What I ended up doing was just use...
objective-c,xcode,swift,interface-builder
This is list of key commands that trigger actions on the responder. You can look to Apple documentation at UIResponder class and it's "keyCommands" property: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIResponder_Class/index.html#//apple_ref/occ/instp/UIResponder/keyCommands Or you can go through some tutorial how to use this feature, like this one: http://www.danandcheryl.com/2014/04/how-and-why-to-implement-keyboard-shortcuts-in-ios-7...
ios,xcode,xcode6,interface-builder,nslayoutconstraint
It's indicating that there is a problem with your layout. Either your views are not properly positioned, there is an unresolvable conflict between your constraints, or some properties are ambiguous because constraints are missing. If you look at the inner left pane there will be a little yellow or red...
swift,interface-builder,watchkit
Unfortunately there is no way to do it programmatically at this time. So, it means that you can not change it on run time. Whatever you can do, you can find the answer on the Watch App Programming Guide. We have to admit that there are so many limitations on...
ios,iphone,xcode,interface-builder
This is just a visual bug in Xcode 6. Whenever you copy an element with text, that text's font-size seems to visually be altered. However, when you build and run the app, it should show up normal on your device or simulator. You can fix the visual bug by clicking...
ios,autolayout,interface-builder,nslayoutconstraint,xcode-storyboard
If you are confused about the NSAutoresizingMaskLayoutConstraints in that list, it might be because you haven't called setTranslatesAutoresizingMasksIntoContraints(false) on that view. (although, I was under the impression that SnapKit does that for you). If you are confused about the NSIBPrototypingLayoutConstraint, that's an auto-generated constraint by Interface Builder. To get rid...
From the NSBox documentation: Special Considerations Functional only when the receiver’s box type (boxType) is NSBoxCustom and its border type (borderType) is NSLineBorder. ...
ios,swift,ios8,interface-builder
I ended up figuring it out on my own. You need to make a swift file for that UITableViewController that is embedded into the UIViewController. Then make sure your tableview is a delegate, and then call the override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { tableView.deselectRowAtIndexPath(indexPath, animated: true) } in...
ios,objective-c,interface-builder
Just remove all the outlets and recreate them again. You just missed or duplicated one of them, since you have several textfields it is highly possible something has gone awry. And make sure that each nextField really points to next field :) UPDATE: It's late night so I missed one...
xcode,cocoa,interface-builder,tableview
Yes, it's strange that that's still there. It's useless and has no effect on anything, but you can't delete it. Ignore it.
xcode,swift,fonts,interface-builder
You can always check for device type. if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad) { //label font size for iPad } else { //label font size for iPhones } We have a enum to define for device type check. enum UIUserInterfaceIdiom : Int { case Unspecified case Phone // iPhone and iPod touch...
ios,interface-builder,xib,initwithcoder
I have tried all answers but this is the only code that worked, after several trials: - (instancetype)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self.view == nil) { NSBundle *mainBundle = [NSBundle mainBundle]; [mainBundle loadNibNamed:@"MonthDayPicker" owner:self options:nil]; [self addSubview:self.view]; return self; } return nil; } ...