uistoryboard

unwind with custom segue on UINavigationController pop via “back” button

自作多情 提交于 2019-12-04 08:57:47
问题 Simple storyboard setup: UIViewController with UINavigationController. On a table cell click a custom segue pushes a new UIViewController onto the navigation stack. All good. But then pressing the "back" button in the navigation bar, it only uses the default pop animation. How do I tell the navigation controller to use my custom segue when popping back? I've added - (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController

viewController custom init method with storyboard

余生长醉 提交于 2019-12-04 07:39:28
问题 im having trouble overriding the initialization method for my CustomViewController thats designed in my Storyboard. now im doing (in my mainViewController): self.customViewController = [[UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:@"CustomVC"]; self.customViewController.myObject = someObject; and i have in viewDidLoad (CustomViewController) [self.label setText:self.myObject.someString]; This works ok. But, is it the correct way?

Closing a view displayed via a modal segue

风流意气都作罢 提交于 2019-12-04 07:31:51
问题 I'm manually invoking a segue (set as modal) in order to display a login form in Xcode 4.2 using Storyboards with the following line of code: [self performSegueWithIdentifier:@"LoginSegue" sender:nil]; I'm probably missing something really simple, however I can't find a way to programmatically close the login view and return to the previous view. The view is part of a navigation view controller, so setting the segue type to "push" allows me to use the back button to send me back to my

Storyboard - Position is ambiguous for “Round Style Text Field” Warning

北战南征 提交于 2019-12-04 07:19:19
https://stackoverflow.com/a/16251810/2589276 I solved the problem above but got a new problem when I did the steps I was instructed to. Now I get a warning saying: Position is ambiguous for "Round Style Text Field" I tried setting fixed constraint for width also, but did not fix this warning. Any ideas? Are there any other information I should give for this problem? This screen shot when I do add constraint to x, leading space constraint (for x) and vertical space constraint from the bottom. I just want to set constraint for the Y and not get warnings, I do not use autolayout anyways. Edit:

prepareForSegue **always** creates a new destinationViewController?

房东的猫 提交于 2019-12-04 06:36:56
I Just realized that the following code always creates a new TagsFeedViewController. Is this the default behavior of segues? Is there a way to configure iOS to not create a new destinationViewController every time? - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"showSearchResult"]) { TagsFeedViewController *destViewController = segue.destinationViewController; destViewController.query = query; } } Caleb Segues use whichever view controllers are provided to their – initWithIdentifier:source:destination: methods. It's not the segue

Xcode change storyboard's frame value automatically cause git merge conflict all the time. How to solve it?

北慕城南 提交于 2019-12-04 06:29:39
Every time when I merge other team member's iOS objc project, I got some strange conflict like this: <<<<<<< HEAD <rect key="frame" x="254.00000003476939" y="0.0" width="63" height="21"/> ======= <rect key="frame" x="254.00000010362709" y="0.0" width="63" height="21"/> >>>>>>> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX We never change the value of x, and we always give integer like value. Obviously, Xcode changed the value automatically. How to prevent this kind things happen? You could avoid checking in such modified value by convincing Git that the file content has not changed. That is possible

Getting Initial View Controller from Storyboard inside the App Delegate

我们两清 提交于 2019-12-04 05:53:22
I am trying to access the initial viewcontroller of my storyboard. It is a navigation controller which is wired up to a second viewcontroller via a seque. So after my application did finish launching I want to directly show the viewController that is connected through the segue. I tried it out with code like this but it doesn't work ... UINavigationController *navController = (UINavigationController*)self.window.rootViewController; [navController.topViewController performSegueWithIdentifier:@"showLoginScreen" sender:self]; What am I doing wrong? 4 years later : If I look at my question again

Pass data back with dismissViewControllerAnimated

て烟熏妆下的殇ゞ 提交于 2019-12-04 05:18:35
I have a FirstViewController and a SecondViewController . I created a button in FirstViewController in order to perform a segue modally to SecondViewController . In SecondViewController I have a tableView showing a list of 8 items, as I select an item from that list, I dismissViewControllerAnimated: , going back to FirstViewController . What I would like to do is pass a string back to the FirstViewController . I used this post as a reference for my code: dismissModalViewController AND pass data back So this is what I have: in FirstViewController.h #import <UIKit/UIKit.h> #import "AppDelegate.h

“Installed” option in Attributes Inspector

情到浓时终转凉″ 提交于 2019-12-04 05:11:11
In Attributes inspector there is an option Installed . I am unsure of it's meaning. Does it mean that the element will be present in any size class? It is for adding that specific view to the corresponding size class. If the installed is checked it will be added to the view hierarchy of that size class, else it won't be added. You can check more about this option in Enable And Disable Views . 来源: https://stackoverflow.com/questions/33975427/installed-option-in-attributes-inspector

How do I create a keyboard accessory view with Auto Layout in Interface Builder?

老子叫甜甜 提交于 2019-12-04 03:49:12
问题 I want to add a "Done" button and a segmented control to a Decimal Pad keyboard. Ideally I would like to lay out a keyboard accessory view with Auto Layout in Interface Builder. Is this even possible? Do I create a new XIB or can I do it in the existing Storyboard scene somehow? How do I attach the accessory view to the appropriate text field? 回答1: Would you mind doing it programmatically? Typically you take a UIToolbar to a UITextField with your items, but you may need to subview the