uistoryboard

Getting subViews' frames in Storyboard

断了今生、忘了曾经 提交于 2019-12-18 17:11:30
问题 I just want (for now) to get the dimensions of a subview on the view controller's instantiation. [This is a reduction to as simple a case I can find of a previous question. I am trying to figure out why subViews of scenes in Storyboards are not behaving the way I expect, which is to say: like XIBs do - I just want to get dimensions of my subviews before anything is actually drawn to the screen] To condense the problem down to a new, clean project, I do this: create a new, single view project

Content inset not working Storyboard Xcode8

ε祈祈猫儿з 提交于 2019-12-18 13:59:30
问题 Recently I have updated Xcode 7.3 to 8. While opening the project the project settings also have been updated for new Xcode. Now the insets given for a button image for positioning the image inside button frame is not working as in previous Xcode(7.3) version. The image insets are given through storyboard. Image was used here to have large clickable area for button than the button image display area. Is there any other options to get it through storyboard. 回答1: In Xcode 8 the button content

Make button it UIAlertView perform Segue

谁说我不能喝 提交于 2019-12-18 13:17:02
问题 I have created a UIAlertView for an action which gives me 2 options. I want the user to be able to click on a button and have it perform a Segue. Here's the code I have so far: - (IBAction)switchView:(id)sender { UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Please Note" message:@"Hello this is my message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Option 1", @"Option 2", nil]; [myAlert show]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:

Instantiating a View Controller programmatically with Storyboard from AppDelegate

混江龙づ霸主 提交于 2019-12-18 12:26:28
问题 I'm busy building an app - that when launched for the first time it asks the user to do two things: Select a Country Accept T&Cs From there it goes to the home view controller. The problem I am currently facing is pushing the first view controller onto the screen from my app delegate. I'm using storyboards / Xcode 5/ iOS7 Here is the code I came up with: UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController; UIStoryboard *mainStoryboard =

iOS Container View doesn't honour intrinsicContentSize

这一生的挚爱 提交于 2019-12-18 11:20:06
问题 I want to use a Container View to contain a camera preview. I want the camera to centered in the middle and maintain it's proper aspect ratio. (it's pink to make it obvious where its frame is) I'm stuck on the first step of trying to get the camera preview to appear at a size that's smaller than the container. I have a UIView subclass for the Camera Controller's view, and have the code: - (CGSize)intrinsicContentSize { return CGSizeMake(320, 240); } Unfortunately this isn't honoured: From

Moving UIView from bottom to top

别来无恙 提交于 2019-12-18 11:17:11
问题 How can I move a view from bottom to top on my code: colorView.hidden=NO; colorView=[[UIView alloc]init]; colorView.frame=CGRectMake(0,480,320, 480); colorView.bounds=CGRectMake(0,200,320, 280); colorView.backgroundColor=[UIColor greenColor]; colorView.alpha=1.0f; [webView addSubview:colorView]; [self.view addSubview:webView]; [self createTransparentView]; So how can I add the animation here? 回答1: Initially, add your view: self.postStatusView.frame = CGRectMake(0, 490, 320, 460); For the

Present storyboard ViewController from another ViewController

微笑、不失礼 提交于 2019-12-18 10:52:56
问题 I have multiple UIViewControllers in my iOS App's Storyboard. I want to open one of the UIViewControllers (in the storyboard) from a different UIViewController. I've tried the code below, but it isn't working even though I used it before iOS 5 and it worked fine. - (IBAction)addNotes:(id)sender { NotesViewController *notesView = [[NotesViewController alloc] initWithNibName:@"NotesViewController" bundle:nil]; [self presentModalViewController:notesView animated:YES]; } How can I perform this

Swift TableViewCell xib doesn't have constraints

爷,独闯天下 提交于 2019-12-18 07:16:20
问题 I have two TableView s, when I designed the original I designed it using the prototype cell in the storyboard, to make it reusable I tried to pull it out into a .xib and load that instead. When it is loaded from cellID.xib however it loses all the constraints at runtime, and everything is layered on top of each other. TableViewController let cellIdentifier = "cellID" override func viewDidLoad() { super.viewDidLoad() tableView.register(UINib(nibName: cellIdentifier, bundle: nil),

Update storyboard to iOS 6 with backwards compatibility [duplicate]

帅比萌擦擦* 提交于 2019-12-18 04:54:04
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Enabling auto layout in iOS 6 while remaining backwards compatible with iOS 5 I'm going to update my app to the new 4 inches display and I figured out that I should check the Use Autolayout checkbox in the inspector. Doing this I loose the compatibility with iOs 5. How can i support the 4" display without loosing this back compatibility? Thank you so much. 回答1: You can use springs and struts to support both form

How to correct Tab Bar height issue on iPhone X

我与影子孤独终老i 提交于 2019-12-17 22:35:59
问题 I'm having an issue with my app when testing for iPhone X. I'm not sure how to adjust this issue, as well as not make it an issue for non iPhone X sizes. This only seems to be an issue on the iPhone X simulator. 回答1: "File inspector" from right of Xcode storyboard, enable Safe Area guide layout to support your app in iPhone This post describes really good. 回答2: On iOS 12.1 I've solved this issue by overriding safeAreaInsets in the UITabBar subclass: class TabBar: UITabBar { private var