How to remove from this Debugger warning [duplicate] - iphone

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Getting “Using two-stage rotation animation” warning with UIImagePickerController
In my iphone app i have a login screen after loging in i am navigating to a class ( i have tab barcontroller with 5 tabs here)
like this i am programmatically creating the tabbar
tabBarController = [[UITabBarController alloc] init];
NSMutableArray *arrControllers = [[NSMutableArray alloc] initWithCapacity:5];
//Add PunchClock to tab View Controller
PunchClock* objPunchClock = [[PunchClock alloc] initWithTabBar];
NavigationController = [[UINavigationController alloc] initWithRootViewController:objPunchClock];
NavigationController.navigationBar.tintColor = [UIColor brownColor];
[arrControllers addObject:NavigationController];
[NavigationController release];
[objPunchClock release];
tabBarController .viewControllers = arrControllers;
[arrControllers release];
[self.view addSubview:[tabBarController view]];
after logging in while navigating to this class i am getting this Debugger warning
2012-07-07 12:09:27.988 WorkForce[1475:207] Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations.
2012-07-07 12:09:28.074 WorkForce[1475:207] Using two-stage rotation animation is not supported when rotating more than one view controller or view controllers not the window delegate
what is it mean,,,how to remove this warning? please help me out

I have no idea what that error message means but when you get such a specific error message, it is often helpful to do a search with the entire error message in quotes to see if anyone else has encountered it.
Apparently they have. Please report back and tell us what it means.

The two-halves animation methods like willAnimateFirstHalfOfRotationToInterfaceOrientation:duration: and willAnimateSecondHalfOfRotationToInterfaceOrientation:duration: are an older approach. If you've implemented these methods, they should be removed so that the one-step scheme (in this case, willAnimateRotationToInterfaceOrientation:duration:) can be used.

Related

UIView not appearing over keyboard?

I have this code:
JMenuController *menuController = [[JMenuController alloc] init];
NSArray *buttonsArray = [NSArray arrayWithObjects:#"From Libary", #"Take Photo or Video", nil];
[menuController showMenuWithTitle:#"Add Media" ButtonTitles:buttonsArray animated:YES];
self.currentMenuType = JCreateMenuTypeNewMedia;
[[[[UIApplication sharedApplication] delegate] window] addSubview:menuController];
The problem is, the view appears below the keyboard, which is already on screen. How do i fix this?
The easiest way to display some view on top of the keyboard is put that view inside a UIWindow for which you set the windowLevel property to UIWindowLevelAlert. Something like:
UIView *myView = [[UIView alloc] initWithFrame:rect];
UIWindow *myWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
myWindow.windowLevel = UIWindowLevelAlert;
[myWindow addSubview:myView];
[myWindow makeKeyAndVisible];
If you're using ARC, make sure you keep a strong reference to myWindow. Otherwise, it'll get automatically released and so it won't get added to your application windows.
(This is how UIActionSheet and UIAlertView work internally. When one of them is visible, have a look at [UIApplication sharedApplication].windows and you'll see they create windows with their windowLevel set to UIWindowLevelAlert.)
Ok it took awhile for me to understand what you wanted to do. You have 2 options.
Resign the keyboard and show the view with the buttons.
Use a UIActionSheet to display the buttons over the keyboard like it does in the Messages application when you press the camera to send a picture to someone.
I would recommend the later.
Edit:
Take a look at this for your custom UIActionSheet Show a view over the keyboard
The keyboard exists in its own window. To put things over it, you either have to put things into the keyboard's window (this is not a supported behavior), or create yet another window and put it over the keyboard.

navigationController crash

I have a question about iPhone develop
CarDetailDetail *myview = [[[CarDetailDetail alloc] init] autorelease];
myview.detailMaintainID = self.detailMaintainID;
[[self navigationController] pushViewController:myview animated:YES];
this is work fine in iPhone 4 (iOS 4.3) and iPhone 3gs (iOS 5.X)
but iPod touch (iOS 4.2) will crash when I pop back one or two times,
memory warning will appear and has bad access error
but when I not release *myview (remove autorelease keyword) , iPod works fine...
I don't know why , some one can help me? thanks
Experiment with the YES/NO flag on the pop animation
If you find that you are getting no crash on your problem device with NO pop animation it probably indicates a timing issue of some sort.
In other words a block or web thread is trying to hit a view controller which has been deallocated already.
post your your console logs in the question too for more help.
try doing this
CarDetailDetail *myview = [[CarDetailDetail alloc] initWithNibName:<name of view contrlle> bundle:nil];
//Remove this bit of code myview.detailMaintainID = self.detailMaintainID;
[[self navigationController] pushViewController:myview animated:YES];
[myview release];

Problem with getting a modalViewController to appear

I've been fighting with this for hours. I've searched around everywhere and just can't seem to find the solution to my problem. I'm pretty sure I'm just lacking some key concepts here.
My AppDelegate (didFinishLaunching) basically sets up my window and invokes RootViewController:
// create our window
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window setBackgroundColor:[UIColor blackColor]];
// create our rootviewcontroller
RootViewController *controller = [[RootViewController alloc] init];
// add our rootviewcontroller's view to our window
[window addSubview:controller.view];
// controller is now owned by window's view
[controller release];
// show us to the world
[window makeKeyAndVisible];
When I add controller.view as window's subview, my understanding is that RootVC's loadView will automatically get called.
In RootVC loadView, I create a tabBarController, each tab having a navigationController and it's own viewController. All that is working fine.
In RootVC viewDidLoad, I'm checking to see if this is the first time a user is running this app, and if so, I want to throw up a modal welcome screen. This is the part I'm having trouble with.
I'd like to keep as much code out of the RootVC's viewDidLoad method, and ideally would be able to accomplish what I want with this:
WelcomeViewController *welcome = [[WelcomeViewController alloc] init];
[self presentModalViewController:welcome animated:true];
[welcome release];
Obviously this isn't working. WelcomeVC's loadView hasn't been run yet because I haven't explicitly set it's view property. I've played around with a bunch of different solutions (welcome.view - [[UIView....], using WelcomeVC's init method to set self.view) but I just can't seem to get that modal to pop up.
How should I accomplish what I'm looking for? What are the best practices, and what's the best solution to keep my code tight and tidy?
I'm stuck, so hopefully your solution will allow me to continue developing my app!
Although the problem is not so simple, the solution is. You have to wait until the main view appears. So check the condition and present your modal view in viewDidAppear method, not in viewDidLoad method.

How to do horizontal slice between views?

I'm looking for some advice about the best way to create a multi-view iPhone application. This app will slice left to right and right to left when a it goes from one view to another. Very similar to how a navigation-based application but without the navigation top bar.
I'm doing some tests using this code:
- (IBAction)goToSettings:(id)sender {
SettingsViewController *controller = [[SettingsViewController alloc] initWithNibName:#"SettingsView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
}
something like UIModalTransitionStyleCoverHorizontal which doesn't exist.
So, I'm trying to do transitions, but now sure if that's the best way to do it, in terms of memory management, etc.
In summary, my application will have ~8 views, and I need to be able to navigate between them, going left to right into details, and go back to the left (previous view). What is the best way to do it?
Thanks in advance.
The navigation bar is optional in a navigation-based application. UINavigationController has a - (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated method.
If for some reason that won't work, an alternative might be a paging UIScrollView, but that would be more hacky and more work to get what UINavigationController already gives you.

How can I display a introduction modal view when the app start up?

I have a tab bar application and I want to display those views that most part of apps have, with the name of the company or the name of the app.
I've created the follow viewController
Introduction *introducao = [[Introduction alloc] initWithNibName:#"Introduction" bundle:nil];
I don't know where exactly should I insert the code to show the modal because I have a tab bar application:
[self.navigationController presentModalViewController:galeria animated:YES];
I've tried to insert these lines on appDelegate.. but didn't work.. somebody have an idea?
if you are trying to show a splash screen right when the application opens, you should use a Default.png image instead of a view controller showing an image. Check out the Apple Documentation on Human Interface Guidelines and Beginning iPhone Development.
First of all, you'll need to ensure that you have a navigation controller present to present the model view from. Otherwise in the above code you'll be messaging nil and nothing will happen. Then you'll want to put the presentModalViewController:animated: call in your app delegate's applicationDidFinishLaunching: implementation.
Thanks for all answers.. they were very useful to understand better the process..
I have found a solution that does exactly what I need! So if someone need to create those splash screens with a sequence of images it is very useful:
Just create a ImageView on the Delegates Header and do the following:
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
splashView.image = [UIImage imageNamed:#"Default.png"];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
to control the duration of the splash screen:
[self performSelector:#selector(removeSplash) withObject:nil afterDelay:1.5];
To remove the splash:
-(void)removeSplash;
{
[splashView removeFromSuperview];
[splashView release];
}
so If you want to create a sequence of image just create a method to change the splashView.image.. and create a NSTIMER to call it..