viewcontroller

Xcode Storyboard and xib connection

此生再无相见时 提交于 2019-12-06 11:59:26
问题 I have one story board project with many view controllers and i created one class named "connecter.h,connector.m " now can i connect this class to one .xib file ? Please help me. 回答1: You can create XIB when you create connector.h and connector.m by selecting it subclass of UIViewController and click on the checkbox for: "With XIB for User Interface". If you have created already .m & .h files then you can just add a new GUI file by selecting View from the window & finally setting its

Segue from LaunchScreen to a viewController in Main.Storyboard?

你说的曾经没有我的故事 提交于 2019-12-06 10:00:25
问题 I got some logic I want to do in my LaunchScreen, and if the check is alright, I want to segue to a viewController and if not I want to segue to another, is that possible? 回答1: I got some logic I want to do in my LaunchScreen Now that I understand the question, I can answer it: don't. Do your time-consuming logic later. Your job is to launch fast . You need to get out of applicationDidFinishLaunchingWithOptions , get out of viewDidLoad , and launch . What you show at that point is up to you;

How to change dynamically the xib of a UIVIewController

ぃ、小莉子 提交于 2019-12-06 05:54:28
I have an UIVIewController "controller1" for instance. This controller is instanciated with initWithNibName... with "file1.xib". I want to dynamically change the xib file of my "controller1" to "file2.xib" To resume : "controller1" <-> "file1.xib" and I want to dynamically have : "controler1" <-> "file2.xib" How can I do this ? Hope I was clear. When you want to change views in a UIViewController just just use this code: NSArray *nibObjs = [[NSBundle mainBundle] loadNibNamed:@"file2" owner:self options:nil]; UIView *aView = [nibObjs objectAtIndex:0]; self.view = aView; I have two responses : 1

Passing data between segues without using PrepareForSegue

江枫思渺然 提交于 2019-12-06 02:54:44
I'm creating an user setup account with 5 steps using storyboard. Each step have a ViewController: 1º)Input for Name, contact etc, 2º) Import photos, 3º)Input, etc 4º)more inputs 5º)Confirmation Page, if the user click "confirm" -> Get all the inputs and upload to Parse. The only solution i get when i search online for this, is to create a func "Prepare for Segue" and pass the information...But for me, this doesnt make any sense: If i had 1000 viewcontrollers, the first viewcontroller information will be passsed through all the 1000 viewcontrollers? Why not the nº1000 view controller getting

multiple ViewControllers (containerView? childView? instance of viewController?)

梦想的初衷 提交于 2019-12-06 01:21:37
I need to have a new view(w/ ViewController) added over the top of another. The user interacts with this new view for a while, and then I want to remove it. In an older version of Xcode I was able to add it as a subview. I now get an EXC_BAD_ACCESS error. I don't want the added view as a modal. I need to see the original background through the added view. I've read a lot about the new custom containerViews, addChildView, & presentView. I can't see that any of these are the clear answer. Here's the old code that worked before - Action in the main ViewController: -(IBAction)showWhiteView:(id

What is the method unarchiveFromFile in GameViewController for?

≡放荡痞女 提交于 2019-12-05 13:45:51
When I tried to add different scenes to my game in Swift, I encountered the method unarchiveFromFile. The problem with this method is that it only works with the GameScene class. If you call it from extension SKNode { class func unarchiveFromFile(file : NSString) -> SKNode? { if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") { var sceneData = NSData.dataWithContentsOfFile(path, options: .DataReadingMappedIfSafe, error: nil) var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData) archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene") let scene

Modal Segue Chain

北城余情 提交于 2019-12-05 08:50:50
I have an iOS app that has a log in view ( LognnViewController ) and once a user is successfully authenticated they are taken to another view ( DetailEntryViewController ) to enter some simple details. Once the details are entered the user is taken to the main part of the app that consists of a tab controller ( TabViewController ) that holds a variety of other views. The LogInViewController performs a modal segue to the DetailEntryViewController and the DetailEntryViewController then performs a modal segue to the TabViewController so I have kind of a modal segue chain going to get into the app

Reference to the segue source view controller

跟風遠走 提交于 2019-12-05 04:04:45
Within my viewDidLoad I would like some custom code based upon the previous controller. How can I access the segue source controller or the previous segue identifier in the destination controller's viewDidLoad to handle this? There is no way to get a reference to the segue that created you. You could create a property (sourceVC in my example) in the destination controller, and assign self to this property in the prepareForSegue method (in the source view controller): [(DestinationVCClass *)segue.destinationViewController sourceVC] = self; You can just use [self presentingViewController] and

Unable to select custom class for ViewControllers in Xcode Storyboard

社会主义新天地 提交于 2019-12-05 03:06:31
I just upgraded Xcode to 5.0. I'm still fairly new to cocoa so I hope I'm overlooking something basic. Basically I can't get Xcode to see the custom classes that I want to use as parent classes for view controllers. Originally I wanted to create a custom class for a tableview controller but to simplify the problem I tried it with regular viewcontrollers, but that doesnt work either. What I do: Create new project: Single View Application Add a cocoa class to it (File->New->File->Objective-C class. I name it MyViewController and make it a subclass of UIViewController I select the default view

Looking for concept for managing game level views, level selection views, preferences view, storing levels, environment variables

六眼飞鱼酱① 提交于 2019-12-04 19:33:18
I'm developing a puzzle game application - watch on youtube - for iPhone, and the actual "in-game" part is almost done . It is a separate Class (subclass of UIView) what initializes with a puzzle clue, puzzle pieces, and is ready to send a message for somebody if the puzzle has solved ("completeness" check invoked on every touchesEnded). Now I'm troubled how to design the whole application pattern programatically. The game needs a main menu view , a puzzle selector view , fromwhich I can "create" puzzleLevel instances , I have to store the actual puzzle data in a separate class (I suppose),