xcode-storyboard

UIStoryboard Couldn't find view controller with identifier

自作多情 提交于 2019-11-30 19:30:25
I have an ios application using storyboards with a bunch of view controllers. After Adding a new ViewController, and configured the identify (Storyboard ID) I try to instantiate the new ViewController with the following code: SurveyNewViewController *newSurvey = [[self storyboard] instantiateViewControllerWithIdentifier:@"newSurveyView"]; [self presentViewController:newSurvey animated:YES completion:nil]; Everything seems to be right, but when running the application on the simulator it crashes: ** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (

iOS 5 Segue not working after the first execution

本秂侑毒 提交于 2019-11-30 16:28:43
I'm creating an iOS5 application using the storyboard features. The basic structure is: LoginScreen ---(segue)--> MyScreen ---(press on logout)------(segue back to login screen)-->LoginScreen it's pretty simple. The way I manage the first segue is: - (void) onResponse:(NSMutableDictionary *)response { NSLog(@"Login successful,token received"); // if the Login was successful,store the token NSUserDefaults* userPref = [NSUserDefaults standardUserDefaults]; [userPref setObject:[response objectForKey:@"Token"] forKey:@"AuthToken"]; [userPref synchronize]; //..and let the user getting in [self

iOS 5 Segue not working after the first execution

谁说胖子不能爱 提交于 2019-11-30 16:10:08
问题 I'm creating an iOS5 application using the storyboard features. The basic structure is: LoginScreen ---(segue)--> MyScreen ---(press on logout)------(segue back to login screen)-->LoginScreen it's pretty simple. The way I manage the first segue is: - (void) onResponse:(NSMutableDictionary *)response { NSLog(@"Login successful,token received"); // if the Login was successful,store the token NSUserDefaults* userPref = [NSUserDefaults standardUserDefaults]; [userPref setObject:[response

How to use NSViewController in an NSDocument-based Cocoa app

╄→гoц情女王★ 提交于 2019-11-30 12:19:52
问题 I've got plenty of experience with iOS, but Cocoa has me a bit confused. I read through several Apple docs on Cocoa but there are still details that I could not find anywhere. It seems the documentation was written before the NSDocument-based Xcode template was updated to use NSViewController, so I am not clear on how exactly I should organize my application. The template creates a storyboard with an NSWindow, NSViewController. My understanding is that I should probably subclass

How to change constraints programmatically that is added from storyboard?

眉间皱痕 提交于 2019-11-30 10:30:54
问题 I have one screen. It will display like below Now When User clicked I have an Account and Password(button) it will display like below I want to move both views accordingly I added constraints using storyboard.Now need to change constraints from programming.. 回答1: You need to create an IBOutlet of your constraint. Then you set the constant value of your constraint in code: labelWidthConstraint.constant = newValue If you want it animated you can do something like this: Swift

Xcode Storyboard displaying the new iPhone 5 screen size?

假装没事ソ 提交于 2019-11-30 08:01:42
I have the latest version of Xcode. In one of my projects I noticed that the views for the iPhone were the new iPhone 5 screen sizes. I like it but is there a way to switch back to the smaller screen size? Not everyone has the iPhone 5. Also, when your building your interface, you'll see a small icon that lets you quickly switch between 4" and 3.5" screens. It's the rectangular icon on the left. It toggles back and forth between phone sizes. There's a size property in the attributes, so you can choose the pre iPhone5 size of 3.5 Update: It's now under Editor->Simulated Screen. It's combined

How to incorporate storyboards into a cocos2d 2.0 project?

寵の児 提交于 2019-11-30 07:32:42
I have made a project in cocos2d 2.0 and would like to incorporate a main menu using storyboards. I have tried Jerrod Putnam's tutorial here on tinytimgames.com (I can't provide the link because new users are allowed only 2 links per post, but if you google "cocos2d storyboard" it is the first link) but it did not work for me. I followed it exactly (I think). I opened my cocos2d project and imported the files from his github, the CCViewController.m and .h and then created a new storyboard file and followed the tutorial. However when I ran it, it just started straight on my cocos2d game and not

Extra top white space since IOS 8 using autolayout and scrollview

扶醉桌前 提交于 2019-11-30 05:20:25
Since the new update to IOS8, i have an extra white space over my contentview in my scrollview. My content view should be centered in my scrollview and it's work fine on IOS7. Here is the result : Here is the storyboard version which doesn't have white space : I'm wondering what could cause this extra space, is there anything new in ios8 that will cause my content view to have extra space ? Maybe i need to change how i layout my view ? Thanks! EDIT : My solution was to only uncheck adjust scroll bar inset in my views which had the problem. However the solution below that i accepted works too.

How to override trait collection for initial UIViewController? (with Storyboard)

偶尔善良 提交于 2019-11-30 05:19:23
I have an app targeted iOS8 and initial view controller is UISplitViewController. I use storyboard, so that it kindly instantiate everything for me. Because of my design I need SplitViewController to show both master and detail views in portrait mode on iPhone. So I am looking for a way to override trait collection for this UISplitViewController. I found that I can use override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator!) { ... } but, unfortunately, there are only methods to override child controllers traits

Setting backgroundColor of custom NSView

假装没事ソ 提交于 2019-11-30 03:46:16
What is the process of drawing to NSView using storyboards for osx? I have added a NSView to the NSViewController. Then, I added a few constraints and an outlet. Next, I added some code to change the color: import Cocoa class ViewController: NSViewController { @IBOutlet var box: NSView! override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear() { box.layer?.backgroundColor = NSColor.blueColor().CGColor //box.layer?.setNeedsDisplay() } override var representedObject: AnyObject? { didSet { // Update the view, if already loaded. } } } I would like to do custom drawing and