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.
Related
In Facebook API in FBDialoge.m file ,
I want that login window to open on another VC,
so in FBDialoge.m file ,
I am changing this code ..
UIWindow* window = [[UIApplication sharedApplication].windows objectAtIndex:0];
[window addSubview:self];
[window addSubview:_modalBackgroundView];
to
SettingsPopover *svp = [[SettingsPopover alloc] init];
[svp.view addSubview:self];
[svp.view addSubview:_modalBackgroundView];
but that login window is not coming on SettingsPopover , can anyone tell me what should I do here?
Here instance of SettingsPopover *svp is new one which will add subviews but will not take effect until this new instance is used. Where ever u added SettingsPopover in viewcontroller that the reference i m talking about.
I mean u need original reference of SettingsPopover to take effect by adding subview.
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.
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.
I'm currently building a universal app.
After the user taps a button, I present some settings in a modal View in the following way:
viewCtrl.modalPresentationStyle = UIModalPresentationFullScreen;
viewCtrl.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:viewCtrl animated:YES];
On the iPhone and iPad both Transitionsstyles look the same. Now the problem is, on the iPad the background, behing the tilting view, is white. This white background just looks ugly.
On the iPhone it is black, as it is supposed to be.
I also tried adding a black backgroundview to my [UIApplication window]
UIView *bgView = [[UIView alloc] init];
[bgView setBackgroundColor:[UIColor blackColor]];
[window addSubview:bgView];
but it doesn't make a difference.
I think it is as simple as setting the UIWindow background color to black. For example, if you open the MainWindow.xib in IB, you should be able to set the background there - or in your AppDelegate you should be able to set the background of the UIWindow.
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..