UITabBar ignoring occasional "clicks" - iphone

I'm working on an iPhone app that has a UITabBar. Occasionally the tab bar ignores my "clicks" (or "taps", or whatever they're called in the iPhone world). It happens on both the simulator and the on the device. Clicking on a tab bar button won't result in any action, and I have to click it several times for the expected action to occur.
Can anybody shed any light on what might be causing this issue, or how I can go about debugging it?

I read somewhere that the UITabBar becomes unresponsive when it is not the immediate child of the window. It can be something like that or you might have a UIScrollView or some other view interfering with your UITabBar.
P.S
Click is correct for buttons, including tabs. For others, a widely used term is touch.

This might be happening bcoz the view is not getting loaded when you click on the tab.
Are you using any url request in the -(void)viewDidLoad method. If this is the case may be ur internet is workin slowly.

Related

iphone app shows white screen when first launched, but okay when entered again

the iphone app I am writing shows white screen when first launched, but become okay when entered again.
when I press home button of iphone, then enter the app again, it displays correctly.
(actually when I have just pressed the button and when seeing the app goes from foreground to background, I saw the correct app root display)
This problem also happen when I haven't enter the app for a certain period of time.
Anybody has ever encountered this problem?
How can I solve it? Thanks!
you may not be setting the rootViewController in applicationDidFinishWithOptions: but instead setting them in applicationWillEnterForeground
could you post your code for those two functions so we can see
Based on your description I'd say that in your app delegate, the code you want in application:didFinishLaunchingWithOptions: is in applicationWillResignActive:.
I couldn't have described my problem better myself, so you can imagine my frustration at the answer not being here yet. To that end I'll add my solution:
Given that you're doing the right stuff in your applicationDidFinishWithOptions: method and not in applicationWillEnterForeground, something along the lines of:
navcontroller = [[UINavigationController alloc] initWithRootViewController:homeViewController];
[window addSubview:nc.view];
[window makeKeyAndVisible];
make sure to double check the following:
Your delegate is hooked up to the appropriate window in your MainWindow.xib
You've ticked the "visible at launch" box in interface builder for the window.
In your Target Info (or info.plist) make sure "Main nib file base name" is "MainWindow"
This is the bit that caught me out - if you have two windows in your mainwindow nib (I had a second that I use later to display a full screen image) make sure that you hide it, I set it to hidden in interface builder and unhide when you need it, I also unchecked the "visible at launch" box for good measure.
From a spot of googling I found that if you're getting a white screen you'll likely be getting an "Applications are expected to have a root view controller at the end of application launch" error, meaning the delegate can't find a nib to load, however if you're getting a black screen and nothing in the debugger then it is loading some nib just not necessarily the one or the part of one you're expecting. Mine was loading the blank window over the one that I wanted (the one with the correct nib in it), (I think).
Happy bug fixing!

UIToolBar missing due to iPhone Message Compose Screen within the app

Something going wrong badly due to Message Compose Screen.
I am working on a TabBar based application. In some screens I am showing ToolBar instead of tabBar by setting hidesBottomBarWhenPushed = YES; and its working fine everytime. But In 1 screen I am sending SMS by opening Message Compose Screen within the iphone App. So problem occurs if I open Message Compose Screen and i clicked Cancel button of Message Screen.
So, whenever going back to that module where I was showing ToolBar. So on click of button no ToolBar. Totally blank, no toolbar and no tabbar (tabbar is quite obvious i have already set hidesBottomBarWhenPushed).. But why toolbar now showing due to Compose screen ?
There is no link with compose screen to this screen. Far different implementation and different controllers.
I have check by debugging, Toolbar frame is also fine.
Please help
Issue fixed... had problem with adding it to keyframe window
I think it is because the MFMessageComposeViewController has got a navigation bar. Your application should be a navigation based application for that. Otherwise your toolbar's frame position will be affected. I had this kind of problem once. So i changed the application into navigation based but hid the navigation controller.
Hope this might help you,
Happy coding!

why would I sometimes lose Navigation items when clicking to return to previous screen in UINavigationController app?

Anyone know why would I sometimes lose Navigation items when clicking to return to previous screen in UINavigationController app?
Background:
have a iPhone app using a UINavigationController and UITableViews
98% of the time things are fine, and if I'm on the detailed screen and click the "back" button things are find. The app takes you back to the main screen (pop's a view off the stack)
a small percentage of the time, and on the iPhone device itself, I click to go back, see some animation start, but I end up (a) on the same page, and (b) no navigation buttons or toolbar buttons appearing
from this state you can't do anything obviously and have to kill the app and re-start
Any ideas? How to fault find? (noting it's only occasionally when testing on an actual device I notice, and it may take hours/days before it does occur)
thanks
Add an alert in didReceiveMemoryWarning function of the viewController. The OS calls viewDidUnload on some memory warning (which don't usually happen in simulator).

UINavigationItem out of sync when using popToRootViewController

I tap a tab bar item, which triggers poptoRootViewControllerAnimated. Most of the time it works as expected, but in some cases it pops to the correct view, but the navigation item is out of sync, "stuck" from the view i previously was at.
I've read about people having this problem with iPad's, when in landscape mode, but the solutions I've found don't work in this case. This is an iPhone app in portrait mode.
Happens with the simulator as well as on an actual iPhone. If someone has a suggestion or solution i'll be a very happy man!
Turns out that the different iOS versions handle this differently. This only occured on the older versions, so we had to rebuild the stack manually there.
do you get any message in the console like
nested push animation can result in
corrupted navigation bar
and
Finishing up a navigation transition
in an unexpected state. Navigation Bar
subview tree might get corrupted.
if yes take a look at these few answers...
but what they all basically mean is you are trying to pop from the navigation controller too early, probably before it is properly loaded...

UITabBarController Initial View?

I'm wondering if it is possible to start my app with all my tabs in the "up" state and show a "landing" view to the user. Kind of like a welcome/quick start. When they select one of the tabs, it switches views as normal.
Will you point me in the right direction?
Kind of like this:
If you're using a UITabBar/UITabBarController, I think you must have the selectedIndex set to some legal value. I don't think this is possible, nor can I find an app on my iPhone or iPod that mimics the behaviour you're looking for.
(The App Store app is as close as it gets, where it looks like it has an empty tab bar before it loads data from the Internet, but it could very well be that they are just re-using the Default.png and superimposing an activity indicator during loading.)
Note that if you tried to submit your app to Apple, they could easily reject it for using non-standard UI.
The way I would probably do this is to create a new ViewController that's just for this screen, but make sure it's last in the viewControllers array managed by the UITabBarController. That way, when you show the tab bar on the screen, you get the 4 tabs and the more button, but the currently selected view controller is not in the bar, meaning that all of the other tabs are unselected.
Once the user has satisfied the condition for showing the screen, you can discretely remove the view controller from the tab bar, and the user will never be the wiser.