viewcontroller

show GKGameCenterViewController in SKScene

六月ゝ 毕业季﹏ 提交于 2019-12-24 14:15:32
问题 I struggling with the following Problem: I've made a game with SpriteKit. I implemented the GameCenter to my game. It works. Player logs in automatically and the highscore will be added to the default Leaderboard. But for example in the "EndScreen" I want to show the GameCenterLeaderboard . Appledocumentation tells me that I should use the following code: - (void) showGameCenter { GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init]; if

Swift ios send user to a specific ViewController in tab based application

假如想象 提交于 2019-12-24 05:59:21
问题 I want to send a user to a specific ViewController in my app once a notification is clicked. I now that I can do something like this: let storyboard = UIStoryboard(name: "Main", bundle: nil) let destinationViewController = storyboard.instantiateViewControllerWithIdentifier("Home") as? HomeViewController presentedVC?.presentViewController(destinationViewController!, animated: true, completion: nil) But my app has a tab bar and looks like this Tab bar tab1: navigationController -> VC1 tab2:

How to load view controller without button in storyboard?

大兔子大兔子 提交于 2019-12-24 01:47:06
问题 I want to load view controller without button. I set the identifier to 10 and tried to use if(...){ //load ViewController2 [[self storyboard] instantiateViewControllerWithIdentifier:@"10"]; } but nothing happens. with this function it s doesn t work too UIViewController *vc = [[self storyboard] instantiateViewControllerWithIdentifier:@"10"]; [self.navigationController pushViewController:vc]; here is my progect http://www.sendspace.com/file/kfjhd5 whats a problem? 回答1: Calling

Notify all loaded ViewControllers of a certain event

点点圈 提交于 2019-12-24 00:58:00
问题 I have a class that synchronizes data in the background every once in a while. The user can be anywhere in the app's navigation tree and no matter where the user is I need to be able to update the view controllers with whatever new data I just synchronized. I put the object in charge of the background thread sync as a property of the SharedAppDelegate. In a way I need to implement something like the Observer pattern and every time I instantiate a view controller set it to listen to some event

How can I pass information between 2 different View Controllers?

痴心易碎 提交于 2019-12-24 00:53:33
问题 This is a simple question: I have 2 different view controllers, and each one has its own data stored in its .m file. I want to take a value, for instance, an integer value ( int i=3; ) that is declared in ViewController1 and pass it to ViewController2, so I will be able to use that value in the second view controller. Can anyone please tell me how to do it? 回答1: 2014 Edit - in case somebody happens upon this, don't listen to me. The "better way" really is the best way. Good Way - Create your

'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name

落爺英雄遲暮 提交于 2019-12-23 23:58:43
问题 I have a window based applicaiton with tab bar and navigation bar integrated into it. On the navigation bar have a custom button which opens a table view. On clicking on the cell of the table I want to open a new table view controller. But as soon as I click on the cell of first table I get an exception that Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'AddForm'' I have checked

Either AppDelgate is called or ViewController is

别说谁变了你拦得住时间么 提交于 2019-12-23 04:40:21
问题 I am wanting both my AppDelegate and my ViewController to be called on startup (as expected). When only the ViewController is called: main.c int main(int argc, const char * argv[]) { return NSApplicationMain(argc, argv); } When the AppDelegate is called and the view controller is not. main.c #import "AppDelegate.h" int main(int argc, const char *argv[]) { NSArray *tl; NSApplication *application = [NSApplication sharedApplication]; [[NSBundle mainBundle] loadNibNamed:@"ViewController" owner

Modal Segue Chain

两盒软妹~` 提交于 2019-12-22 06:49:30
问题 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

Access label.text from separate class in swift

六眼飞鱼酱① 提交于 2019-12-22 01:38:04
问题 I have a viewController with a button allowing user to download a file from a url. To keep my code clean I created a download class that I call from my view. It works fine but now I want to provide users with some UI cues about the download. Let say I have a label and I want to change its text to "Downloaded" once the download is over. How one should do that? here is the code I have: FileViewController @IBOutlet weak var downloadLbl: UILabel! func downloadFile(sender:UIButton!) {

iOS Integrate PKRevealController with Storyboard & Auto Layout

时间秒杀一切 提交于 2019-12-21 09:27:17
问题 I'm trying to integrate PKRevealController into an existing project of mine. https://github.com/pkluz/PKRevealController How do I set up my left view controller, right view controller, and front view controller if I'm using storyboard? The readme says to do... PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontVC leftViewController:leftVC options:options]; self.window.rootViewController = revealController; Where would I put these lines of