UINavigationItem setHidesBackButton:YES won't prevent from going back - iphone

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;

Related

Using EGOPhotoViewController with iPhone 5

Using this on iPhone 5:
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithImageURLs:imageURLs];
[self.navigationController pushViewController:photoController animated:YES];
When I get back to the caller I can see the bottom bar... How should I solve this?
That doesn't happen on 3.5 inch screen.
UPDATE:
Same problem happens on EGOPhotoViewer_Demo
This is how the screen looks on the first usage:
When getting into "Photos" and go back to that main screen it change to:
You can see something hides the bottom of the screen. On my app I have buttons there so it's problematic.
Hope this update makes my problem more clear.
I’m not sure but this might be a duplicate of iPhone 5 app displaying correctly but not sensing touches in “extra” space
Also, do you have the same problem on iOS 6? From the screenshots, it seems you are using iOS 7, which could be the source of your problem.
When compiling with Xcode 5 the problem is solved (test device was iOS 7).
I had the same issue.
The problem is the following statement in viewWillAppear:
[self.navigationController setToolbarHidden:NO animated:YES];
Move this statement and the accompanying "if" test to viewDidAppear and the problem goes away.
To be honest I am not sure why this ever worked - but it makes sense that showing the toolbar when our photo view is not yet up would show the toolbar in the parent view, not the photo view. Moving it to viewDidAppear does the right thing.

Missing keyboard in MFMailComposeViewController

I've got this code working well for months (on iOS 5.1), but I didn't check it for a long time and now (probably iOS 6.0 issue) I've noticed that my MFMailComposeViewController doesn't show the keyboard even when focusing textfields like message body or recipients.
The strange thing is that it reacts on taps, so i can set cursor on 'To' or 'Subject' and the cursor appears, or I'm able to hold the tap to make the zooming glass pop up. But no keyboard :(
SCREENSHOT OF THIS
Here's the code I'm using:
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[self presentModalViewController:mailer animated:YES];
I've been searching a lot about this and found something that deals with
[self resignFirstResponder] or [mailer becomeFirstResponder], but it didn't work.
If I add this code before or after presenting controller
NSLog(#"mailer become %d", [mailer canBecomeFirstResponder]);
It shows 0, however, the
NSLog(#"self resign %d", [self resignFirstResponder]);
shows 1, but it was 0 too before i added the
- (BOOL)canResignFirstResponder {
return YES;
}
Docs say it should return YES by default, so it's double strange.
If I create an empty project with such code it works well, but I can't really do this because my current project is quite huge.
Any help would be appreciated, getting stuck here...
Tested both on iPhone and iOS Simulator (both deployment target 5.1 and 6.0)
Just LOL. The problem was with the
[UIApplication sharedApplication] delegate] window] setWindowLevel:UIWindowLevelStatusBar + 1]
somewhere in my app. Seems like they changed keyboard windowLevel in iOS 6, so that now it's behind. I'm quite lazy to do so, but it would be interesting to know exact windowLevel of the keyboard window :)
Be careful with that!
Thanks to everyone for helping anyway!
If you want to show the keyboard, you must take the text box from the mailer and then send the message becomeFirstResponder.
However, there is not straight forward way to do that. When you touch the box of the message, does the keyboard appear?
For others who may have come up with this keyboard issue in the MailComposer this solution worked for me:
Present the view then call "becomefirstResponder" on the same
MFMailComposeViewController in the completion method.
MFMailComposeViewController* mailCon = [[MFMailComposeViewController alloc] init];
[self presentViewController:mailCon animated:NO completion:^{
[mailCon becomeFirstResponder];
}];

Modifying MWPhotoBrowser in iPhone

Hi I am have added the MWPhotoBrowser in my iPhone application it works great but now i need to add a little more functionality to my photo gallery.
basically what to do a couple things:
add a button to the navigation bar
decrease the space between two images.
However I don't know how to approach this problem.. should I subclass the Photo Browser or should I make changes in the Photo Browser's source code.
P.S. i tried to modify the code directly in MWPhotoBrowser.h file which didn't work. No changes were made. I'm super new to iPhone programming so i don't have much idea what is going on. Any help would be greatly appreciated. I know its a noobish question so please go easy on down votes :)
In the MWPhotoBrowser.m file find the setNavBarAppearance method and add this
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self action:#selector(someAction)]; // This can be changed to your liking
self.navigationItem.rightBarButtonItem = rightButton;
[rightButton release];
Set the Padding : 10 to 0;
Its done.
Thnaks

Problem when adding Three20 PhotoViewer to my UINavigationViewController

I want a photo viewer in my iphone app and I liked the Three20 photo viewer. I found it somehow hard to integrate it in my own app where I have my typical UINavigationViewController. So far I succeeded in doing the following:
TTURLMap *map = [[[TTURLMap alloc] init] autorelease];
[map from:#"tt://appPhotos" toSharedViewController:[PhotoViewController class]];
[self.navigationController pushViewController:[map objectForURL:#"tt://appPhotos"] animated:YES];
The only problem is that wenn I click back to my original view, its navigation bar keeps the style of the photo viewer (transperant and shows the view under it).
How can I get back my original navigation bar?
My experience: I once used three20's PhotoViewer and every time I went back from the PhotoViewer to my other view. The system status bar remained black and transparent (while it should be with default style). I solved it by manually and programmatically changing the status bar style every time when the back action was triggered.
Yes, this is a bit of an issue for sure. A good solution, as #diwup says, is to implement a manual fix. I tend to subclass TTPhotoViewer when I need it. Not only does it help with this problem but it also makes it much easier to use I find.
If you decide to subclass, then you should use whatever variation of the following you require:
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.tintColor = myTintColor;
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
}
However, if you don't want to subclass, you can always put the code into the - [viewWillAppear:] method of any class that comes after the photo viewer.

iPhone/iPad: how to change location of home or cancel or any buttons in UINavigationController (with or without InterfaceBuilder)

My question is fairly straightforward and simple.
I have seen code that implements a button (such as a cancel button) that can be added to a UINavigationController. Code looks like this:
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]
initWithImage: [UIImage imageNamed:#"home.png"]
style: UIBarButtonItemStylePlain target: self
action: #selector(cancel:)];
self.navigationItem.rightBarButtonItem = cancelButton;
[cancelButton release];
What I'd like to do is to place these buttons in a custom location in the navigationItem...not in the default rightBarButtonItem or leftBarButtonItem location, but controllable perhaps using x and y co-ordinates...is this even possible? It seems like a simple request, but google searching and documentation reviewing is driving me a little nuts :)
I would appreciate any assistance with this issue.
thanks again,
Edward
I agree with 'Hack Saw' in the case of it being against the Apple 'Human Interface Guide' and thus not recommended...However... If you want to, you can draw additional views into the navigation bar's title view [self.navigationContoller.navigationBar.topItem setTitleView]. Hope that helps!
Here is link to reference: UINavigationItem
They don't make that easy because it would break user expectation. I recommend against it. If you have a serious need for it, you'll probably need to make your own navbar.