So I understand that I can not use storyboard on anything less then 5.0. I have finished my App using storyboard only so am very basic to code.
I am going to re-create my app using XIB, I will create a new XIB file for each of my storyboards.
Want I would like help with is the code I need to cross-fade between each XIB. There will a button linking each XIB.
What do I need to add to ViewController.h and where do I put the code into ViewController.m
Thanks a lot for your help.
Bryce
This is what I use.
- (IBAction)changeViews:(id)sender
{
ModalViewControllerTwo *modalViewControllerTwo = [[ModalViewControllerTwo alloc] init];
modalViewControllerTwo.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[rootViewController presentModalViewController:modalViewControllerTwo animated:YES];
}
Related
I am new to OSX development.
Before storyboards on iOS, when you created a single view application, you would end with this structure:
AppDelegate.h
AppDelegate.h
ViewController.h
ViewController.m
ViewController.xib
The app would start on the delegate and call the xib and its classes, so the entry point to the app would be viewDidLoad inside ViewController.m
I have created an app for OSX. All I have is
AppDelegate.h
AppDelegate.m
MainMenu.xib
I would now to recreate something like the ViewController.h and ViewController.m and transfer control to something like a viewDidLoad, but I see this MainMenu.xib of cocoa has a window inside.
What do I do? Create a custom class for this window? I did not see any equivalent to viewDidLoad, viewDidAppear, etc. What is the equivalent for NSWindow or if this is now how it is done, please tell me.
The AppDelegate should have a applicationDidFinishLaunching which you can use as the entry point. the AppDelegate has a window associated with it by default. You can use AppDelegate to create the various features you would like to use. An alternative is to create a subclass of NSWindowController and have an associated xib for that which you can load when you want. Hope this helps.
I'm new to programming and I need to embed a website in my application (which is blank; I only want to embed the website right now). I've been searching for it since 5:00 PM (It's now 9:30 PM) and I still didn't find anything about that.
What code do I need and in what file I need to write it? What do I have to link together?
I use Xcode 4.5.1 and I'm trying to do a Cocoa application for Mac OS X (not for iOS).
I'm sorry if some of my sentences are not clear, but English is not my primary language.
If you need more information in order to help me, just ask.
In your AppDelegate.h file, add this line below the #import <Cocoa/Cocoa.h> line:
#import <WebKit/WebKit.h>
and add this line below the #property (assign) IBOutlet NSWindow *window; line:
#property (assign) IBOutlet WebView *webView;
Select your MainMenu.xib file.
Open the window inside it, then drag a WebView from the Object Library browser into the window. Align and size it.
There should be an icon representing your AppController object to the left of your UI layout. Control-drag from it to your WebView inside your window. (Do not control-drag from your File's Owner icon!) Release the mouse button. A contextual menu should appear, containing the word webView. Select it.
Add the framework WebKit.framework to your project. Right-click on your Frameworks folder in the resource list on the left side of the Xcode window. Choose "Add files to "<your project name>"... and select the framework using this path: /System/Library/Frameworks/WebKit.framework.
Select your AppDelegate.m file.
In your -applicationDidFinishLaunching: method, replace the comment with this code:
// I provided Apple's URL, but this is where you provide your own instead.
NSURL *url = [NSURL URLWithString:#"http://www.apple.com"];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[[[self webView] mainFrame] loadRequest:urlRequest];
Build and run. When the window appears, you should see it load the web page you described in the URL.
A few final words:
I see that you're new here. What I've just done, in the context of Stack Overflow, is to give you a gift. You need to try a little harder looking for resources on the Web. I found two myself, but because they're a bit old (and the development tools look different enough), I embarked upon this answer. I want you to promise that you'll work harder to find answers for yourself. A great place to begin is by reading Apple's own very excellent documentation.
Did you find the Apple tutorial on this very subject:
WebView *webview = [[WebView alloc] init]; // or initialise using the modern-equivalent of InterfaceBuilder
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlText]]];
I have xcode 4.5.2. I've tried for a whole day but i couldn't manage to find an appropriate tutorial or sample to create a tab bar application
If i create a tabbed application, i don't know how to add tabs into controller.
If i create an empty application, i can not start it with tab bar controller on window.
I created a xib file. Make it the main source interface source in targets. Add a window and a tabbarcontroller there and link them with the outlets of the appDelegate.
In appDelegate.m in the didFinishLaunchingWithOptions i add the following code
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window addSubview:self.tabbarController.view];
[self.window makeKeyAndVisible];
and nothing helps.
What's the matter?
How can I do that?
Look at this tutorial may help you ,
Creating a Tab Bar Application Using Storyboards.
i want to put splitviewcontroller xib after the viewcontroller xib in ipad version.i tried to search but it only shows to set splitviewcontroller xib from MainWindow..but i want to put normal view controller xib in starting and after that splitviewcontroller xib should be call.
any help will be appreciated
thank you.
i think u want present modal view controller for that.
as a new bee take a look at this to
http://mobileorchard.com/new-in-iphone-30-tutorial-series-part-2-in-app-email-messageui/
u have to customize them as u needed
I get really confused using InterfaceBuilder to setup the main window xib file's primary controller view. Is there a good example or simple way to launch the ViewController I want to show by default in the Application Delegate instead of setting it up in InterfaceBuilder's MainWindow.xib file?
you can show your view by code as
FirstViewController *fvc = [[FirstViewController alloc] init];
[window addSubView:fvc];