Last active
December 15, 2015 22:49
-
-
Save Omnipresent/5335890 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AnotherController < UIViewController | |
def loadView | |
end | |
def viewDidLoad | |
super | |
@label = UILabel.new | |
@label.text = 'Some Foo text' | |
@label.frame = [[50,50],[150,50]] | |
self.view.addSubview(@label) #app runs fine if this is deleted | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) | |
@window.makeKeyAndVisible | |
nav = UINavigationController.alloc.initWithRootViewController(HomeController.alloc.initWithNibName(nil, bundle:nil)) | |
nav.wantsFullScreenLayout = true | |
@window.rootViewController = nav | |
true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomeController < UIViewController | |
def viewWillAppear(animated) | |
super | |
self.navigationController.navigationBarHidden = true | |
end | |
def viewWillDisappear(animated) | |
super | |
self.navigationController.navigationBarHidden = false | |
end | |
def viewDidLoad | |
super | |
button = UIButton.buttonWithType(UIButtonTypeRoundedRect) | |
button.frame = [[15,100], [280,50]] | |
button.setTitle("Move to next view", forState: UIControlStateNormal) | |
button.addTarget(self, | |
action: "moveToChildView:", | |
forControlEvents: UIControlEventTouchUpInside) | |
self.view.addSubview button | |
end | |
def moveToChildView (sender) | |
self.parentViewController.pushViewController(AnotherController.alloc.initWithNibName(nil, bundle: nil), animated:true) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment