Problems with UIStoryBoard and Custom SplashView - ios5

As with ios4 i can create my custom view for showing as splash screen and can set rootViewController in appdelegate file using xib
but
with iOS 5 with UIStoryBoard how to set or change default UIStoryBoard to first show the Splash Screen and then the required view in my app it is one navigation controller
Please help me with this
Thanks in advance
Happy Coding :)

Another solution would be to present a modal view controller like that:
- (void)applicationDidBecomeActive:(UIApplication*)application
{
static dispatch_once_t onceToken;
dispatch_once( &onceToken, ^
{
SomeLaunchViewController* launchViewController = [[SomeLaunchViewController alloc] init];
[self.window.rootViewController presentViewController:launchViewController animated:NO completion:NULL];
} );
}
Presenting the view controller modally in -application:didFinishLaunchingWithOptions: didn't work for me — the 'UIStoryboard' mechanism seems to be not yet finished at that time.
Using dispatch_once ensures that the modal launch screen will only show up once and not every time the application becomes active from being in a background state.
This example uses ARC.

Got solution through some research have to use performSegueWithIdentifier:sender: and problem is solved.
No requirement to use any other UIStoryBoard just have to put required UINavigationController
and it's work like charm
thanks to GOOGLE and Apple
Happy Coding :)

Related

display view controller before tab bar controller

I'm starting my first application for iphone. I'm using xcode 4.3.3, IOS 5, and the principle of storyboard.
the home screen of the application is a tab bar controller and I want to display a login before the home screen if the user does not logged.
I can not find a solution: if I have to use the file AppDelegate.m with the function didFinishLaunchingWithOptions() or file of my controller with the function viewDidAppear() or something else.
if someone would help me for a solution
Thank you.
just create the login screen when your app is launched and when your login is succeed push your tab bar controller from there...
It is better to add function in AppDelegate.m to remove unwanted window appearing if not logged in (Your home view will be shown for a moment before redirecting to login page if you write code in ViewDidAppear method).
Another method is add a new view controller and check where to redirect based on log in status from view controller's ViewDidAppear method.
Try using a Modal View Controller, Docs
On didFinishLaunchingWithOptions() or viewWillAppear() try do something like this:
YourViewController *viewController = [[YourViewController alloc] initWithNibName:#"YourViewController" bundle:nil];
viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
viewController.modalPresentationStyle = UIModalPresentationFormSheet;
//Present as Model view controller
["presentedViewController" presentModalViewController:viewController animated:YES];
//release it After presenting to it
[viewController release];
Then to remove it call: dismissModalViewControllerAnimated: (docs)
you can use another view with login screen and Save Bool value in nsuserdeafault then when app is start check for nsuserdefault and show view according to that.
then after you can call everywhere where you want in delegate.m or viewwillappear.

iPhone Create View Before TabBarController on tab bar application template

I'm getting pretty good at using xcode and objective c, but only from the templates.
I wish my application to load to a view to login before it reaches the tab bar controller that i have set up.
I believe this can be done in the 'didfinishlaunchingwithoptions' section of the app delegate but after that I don't have any idea how once the login is successful that i can show the tab controller again.
i'll be grateful for any help :)
Use modal views for this.
Sample example here.
I think you want something like this
LoginViewController *loginViewController = [[[LoginViewController alloc] initWithNibName:#"LoginViewController" bundle:nil] autorelease];
[tabBarController presentModalViewController:loginViewController animated:YES];
inside didfinishlaunchingwithoptions

Xcode: Custom TabBarController

I am creating an application that i want to have instead of the normal UITabBarController i want to make mine so it can scroll;
So i Started by creating a simple window based application and programmatically created my UITabBar and UIScrollBar set both their frames correctly and removed the self.window.rootViewController = viewController1; portion of the code so that my app shows the scrollviewwith the tabbar and not my UIViewController
So this far everithing works as expected.
the problem goes when launching my viewControllers, i currently am using:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{
if (item.tag == 2) {
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:#"SecondViewController" bundle:nil];
[self presentViewController:viewController2 animated:NO completion:nil];
}
}
the problem is that this does work but the view controller is in front of the tabbar so i can't use it to switch views again.
i have tried changing the frame of the view in the viewController so its small enough to fit the scrollview with the tab bar but it just ignores this part, so im kind of stuck here.
if anyone could point me in the right direction or tell me if im ignoring some option that i have to set will be greatly appreciated.
Thanks in advance!
Why make things difficult? just make UIButtons with custom images(images like TabBar "buttons") and put the button in a scrollview ;)

Application tried to present a Split View Controllers modally (there is no split views in my app)

So this app was released to the app store about a month ago. I haven't done anything with it for awhile but today I went to go in and start working on an update. I get this error when trying to prevent a view controller modally. The view controller is the same, standard viewcontroller and there are no split views anywhere in the app.
Does anyone know what could make it think the view is split view? I've never even made a split view controller before.
AddEntryViewController_iPad *vc = [[AddEntryViewController_iPad alloc]init];
vc.delegate = self;
[self presentModalViewController:vc animated:NO];
update: this only occurs on the simulator. When I run it on the device it works fine...dont get it.
well i fixed it just by changing it to the following:
AddEntryViewController_iPad *vc = [[AddEntryViewController_iPad alloc]initWithNibName:nil bundle:nil ];
Strange because it works fine the other way from other viewControllers.

I would like to flip my app's splash screen - how can I mimic the flipside controller's animation?

I've finally gotten a working "alpha" version of my first app installed and (mostly) working on my iPhone 3G. So excited I came into the house and danced a little jig while my wife rolled her eyes at me. Don't care - totally stoked that I figured it out on my own (with lots of help here - thanks again, guys).
I've never really dabbled with or cared about animation; I'm more into utility-type apps. However, I've decided that I'd like to animate my app's opening image / default.png / splash screen similar to the flipside view controller animation - where the image spins from a view on the front to a different view on the back. I've found code for animating between views using the flipside animation, but how would I go about animating from a static *.png image to my navigation-based table view? I'm just not even sure where to start with this one - literally the first time I've ever even searched for anything graphics-related in the documentation.
Any help will be appreciated. As usual, thanks in advance!
You can't do anything with your Default.png, and just for form I'll point out that that HIG guidelines say that you shouldn't use it as a splash screen :-).
I would suggest that you use your initial view controller to duplicate the Default.png, and copy the flip animation code from a basic Utility app template - you probably want to use [NSObject performSelector:#selector(...) afterDelay:0] to get it to flip, called from your initial viewDidLoad:.
You can just present a modal view controller when you first launch using the flip transition instead of the default slide. Have your initial view controller loaded from your xib just display the same image you are using for your Default.png. Once you get the -viewDidLoad call in your initial view controller, push the modal view specifying the transition you want. Something like this:
- (void)showMainView;
{
MainViewController *controller = [[MainViewController alloc] init];
[controller setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:controller animated:YES];
[controller release], controller = nil;
}
As Paul suggested, you should call this using performSelector:withObject:afterDelay:
[self performSelector:#selector(showMainView) withObject:nil afterDelay:0.15];
Hope that helps.