are their any reasons why my UIActionSheet would be taking a while to load. It works fine just after lauch, but as soon as I loop through some actions once or twice, is loads very slow, and you can see the grey backdrop crawl down to finish drawing the sheet.
help?
Sam
Ok, so I found the solution moments later.
I assume this is how it works, feel free to correct me.
U used the cheats animation way of [ UIView ]
and i guess this changed the way for the UIActionSheet to pop up, so I wrote in these two lines before i asked it to show.in.view
- (IBAction)goToBlog{
contactUs.actionSheetStyle = UIActionSheetStyleDefault;
[UIActionSheet setAnimationDelay:0];
[UIActionSheet setAnimationDuration:0.1];
[contactUs showInView:self.view];
}
and that seemed to work. so im happy.
Related
I have a problem with sendSubviewToBack and insertSubview:belowSubview: methods. Simply, I have a button which I'm inserting below another view _centerView. I want the button to stay below the _centerView.
The problem I'm facing is that when I insert a button below the _centerView I see a flicker (just for a short moment) over the _centerView. I tried both sendSubviewToBack: and insertSubview:belowSubview: - same effect.
Do you have any ideas what things may be wrong? Am I missing something? Here is my code:
UIButton* itemButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[itemButton setFrame:CGRectMake(0, 0, 40, 40)];
[itemButton setCenter:_centerView.center];
[parentView bringSubviewToFront:_centerView];
[parentView insertSubview:itemButton belowSubview:_centerView];
I recently came across this same issue, but passing this option to the animation code fixed it. Hopefully this is helpful to you too. I wouldn't have come up with my solution without your comment though, so thanks for that :)
UIViewAnimationOptionShowHideTransitionViews
I'm not sure what the internal structure behind insertSubview is, but if you want to get rid of the flicker, the easiest way would be to hide the view before inserting it and show it again afterwards.
[itemButton setHidden:YES];
[parentView insertSubview:itemButton belowSubview:_centerView];
[itemButton setHidden:NO];
Not the most elegant solution, but it should get the job done.
OK, so after a while it turned out that this is the fault of the window I animated the same time I added the button. I don't know why but the fade in animation of the window was causing this problem. I switched of the animations of my UIWindow and now it works. Thanks for help!
Hope there are some GLKViewController experts out there because I have some problems :)
Just a quick description of my app. I have a UINavigationController in which I push different screens.
At some point, I get to my game screen which is a subclass of UINavigationController. In this screen, in viewDidLoad I manually create a EAGLContext, GLKView and instantiate a new GLKViewController (to handle my update&draw calls).
I am setting a preferred fps of 30.
The problem is that the first 3-4 update calls come with the correct DT, but then I have 2-3 frames with 1 second between them. I measure the DT using controller.timeSinceLastUpdate.
So I get like:
dt=0.33
dt=0.33
dt=0.33
dt=1.07
dt=1.05
dt=0.33
dt=0.33
After this, I get valid only DT times. I have no idea why those frames have that kind of delay. I measured the time it takes me in the update & draw method, and it's nowhere near 1 second.
Also, I'm not loading any textures/creating any geometry. Everything is done at loading since it is a rather small game.
Also, if I pop the game screen controller and then push back another instance of the game screen, this new GLKViewController will only call my update method aproximately every 1 second.
Did anybody have a problem with the framerate when using GLKViewController?
Thanks,
The problem is that you don't know what else the device is doing between your refreshes :)
You might only spent 0.1s working on the next frame but if there is a memory warning then other bits of your app will also take time to process. I guess that the gl controller will do it's best to keep to the preferred frame rate but if lots is going on in the background then there's not much it can do about it.
As long as you make sure that your code is rendering as fast as possible and isn't spiking in the same way as the framerate then it's not your render path. From your question it sounds like you've already tested that.
The other thing you might want to do is to watch out for other notifications that might be passed into your app (i.e. memory warnings).
Finally, is there a pattern to the slow frames - do they coincide with a new image being loaded or a file access? Have you done as much as possible beforehand? EDIT - rereading your question makes me think that you've already done this, sorry!
Sorry I can't be any more use :(
Ok, so I finally figured it out. It turns out that it's not even related to the GLKViewController (surprise surprise!).
It had something to do with the way I'm displaying the game screen view controller, like this:
GameAreaViewController* gameController = [[GameAreaViewController alloc] init];
[UIView beginAnimations:#"animation" context:nil];
[self.navigationController pushViewController: gameController animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView setAnimationDuration:0.7f];
[UIView commitAnimations];
SAFE_DEL(gameController);
If I use an animation duration of 0.3f, then I don't get any lag. At 0.5f sometimes I get it and at 0.7 I was always getting it.
I have followed a tutorial to make a simple launcher view like in facebook app. But nothing is displayed on screen when program runs and it shows only a white screen. I dont know why this is happening plz help.
The tutorial i followed is at [I have followed a tutorial to make a simple launcher view like in facebook app. But nothing is displayed on screen when program runs and it shows only a white screen. I dont know why this is happening plz help.
The tutorial i followed is at http://iosguy.com/2010/10/19/tthree20-a-brief-ttlauncherview-tutorial .]1 .
I encountered the same problem. The solution that worked for me was to set the background of my "MainWindow.xib" to "Clear Color" (default is "White Color").
If you have no xib, you can still set the color in your AppDelegate: [self.window setBackgroundColor:[UIColor clearColor]];
if u need only launcher effect , better try this , light weight library
https://github.com/rigoneri/myLauncher
Hope this Helps!
It seems to me that the method:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
is lacking at the end:
[navigator.window makeKeyAndVisible];
If you need more help, please, post your code...
It's odd, I know, but even if you stated hidesBackButton to YES for the UINavigationItem associated with your view, you will be able to go back just touching the area that was meant to be a back button.
Sharing my solution... (more to come)
First I thought it was a simulator bug and uploaded to the device. But when I reproduced the same behavior there as well I started to think how to get rid of such behavior (since it was essential for me). Came up to such a solution:
[self.navigationItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithCustomView:[[UIView new] autorelease]] autorelease]];
And to show the back button again you write:
[self.navigationItem setLeftBarButtonItem:nil];
That's simple. Use it as a work-around, guys! Very strange this bug survived even in iPhone OS 3.0...
i think hiding back bar button also work as
self.navigationItem.hidesBackButton = TRUE;
I've been moving an alert view slightly higher so i can fit a keyboard on screen as well. I just do this by grabbing the frame of the alert and changing the Y after i have already shown the alert so that the frame variables are legit. This works fine on the simulator, but when I do this on the hardware, the alert starts at the correct position but then almost immediately jumps down to it's original vertical center place. Is the UIAlertView position a fixed thing that isn't supposed to change per the usability guidelines or am i just doing something incorrectly?
Thanks!
What OS are you trying this against? I got this to work on both the OS 3.0 Simulator and OS 3.0 Device:
UIAlertView * alert = [ [ UIAlertView alloc ] initWithTitle:#"Alert" message:#"Alert"
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil ];
alert.transform = CGAffineTransformTranslate( alert.transform, 0.0, 100.0 );
[ alert show ];
CGAffineTransformTranslate takes three arguments: the existing transform, an x transform, and a y transform. In the example I used, the alert view appeared 100 pixels higher than it normally would. Give this a try and see what happens.
Also, I'm pretty certain you can modify the frame before showing the alert as it likely sets up the alert's frame in init to be the center of the entire screen by default.
Since iOS4 moving around UIAlertViews gets tricky. I've noticed that if you add a UITextField subview on the UIAlertView, on iOS4 the alert gets moved up so that the keyboard doesn't overlap it. This doesn't happen < iOS4.
Also I've noticed that the alert's frame isn't initialized even after show is called, so there is no easy programatic way of doing a relative CGAffineTransformation. The only solution would be to do conditional transforms based on the OS version.
To me this looks like threading over undocumented behavior of UIAlertViews that is subject to change at any time. I don't think Apple meant for us to be using the alerts for anything more than texts and buttons (even though their own applications break this rule).
I for one will start building my own custom alerts for this type of scenarios.
Isn't an alert meant to be modal - i.e: you wouldn't generally perform any other user input while an alert is active? If this is the case then why would you need visibility of the keyboard?