iPhone:navigation bar "back" button clickable = NO? - iphone

I know that we can hide navigation bar "back" button. But I dont whant to hide it ! Is there any way to make it just not clickable ?

You can not disable the backBarButtonItem. Setting enabled property of backBarButtonItem to NO doesn't actually disables it.
It seems Apple prevented others("us") from disabling backBarButtonItem, even it ignores the target and action set to backBarButtonItem.

try this
self.navigationItem.leftBarButtonItem.enabled=NO;
self.navigationItem.backBarButtonItem.enabled=NO;
Update:
It seems to be Apple doesn't allow the back button to enable / disable. Instead of that we can hide it.
self.navigationItem.hidesBackButton = YES;

self.navigationItem.backBarButtonItem.enabled = NO;

Disable:
self.navigationItem.leftBarButtonItem.enabled = NO;
Enable:
self.navigationItem.backBarButtonItem.enabled = YES;

The default cancel button cannot be disabled as Apple does not allow this feature.

This doesn't work with the default back button.but it's possible to hide the default back button [self.navigationItem setHidesBackButton:YES];

Yes, you can disable that button, just setenabled property of that button to NO.

Should be possible to disable the button:
backButton.enabled = NO;

Apple does not want you to disable it but you can hide it of course.
self.navigationItem.hidesBackButton = YES;
This especially works well if you have a custom UIBarButtonItem as a button.
In stock applications you would notice features that are not applicable are hidden altogether rather than disabled.

Related

disable the click event of button in iPhone

I am new to iPhone development.
In my application,
i want to disable the click event of button when it pressed first time by the user.
for that purpose
i tried
buttonname.Enable=FALSE;
But the image of button also goes washed like a disable.
i Want to show Image properly and button should be disabled, both at time.
what to do?
Please help me.
Thanks For Your Time.
Set buttonname.userInteractionEnabled = NO; This will disable the action of the buttonname but the UIButton will be shown. Only the clicked event will not work.
Use this code it may help you
[buttonName addTarget:self action:nil forControlEvents:UIControlEventTouchDown];
Try setting its userInteractionEnabled property to NO.

is it possible to disable keyboad(UITextField) without hidding?

I'd like to disable UITextField's keyboard without hidding.
is it possible?
If it's so, could you show me how to do?
thanx
Carsh
if you implement delegate method of uitextfield
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
return NO;
}
It does not show the keyboard.
I don't believe the UIKeyboard can be disabled without hiding it.
If you'd like to disable user interaction with the keyboard, you could add an extra UIWindow on top of your existing windows.
By overlaying the UIKeyboard with a transparent UIWindow, the user would be able to see the keyboard, without interacting with it.
a haha , i have a very very ugly method. you can creat a view whichs frame = the keyboards frame. [view setBackgroundColor:[UIColor clearColor]]; [self addSubviews:view];
I did not try but this should work:
textField.inputView.userInteractionEnabled = NO;

Disable UIView and controls

When a user clicks on a button a popup similar to this image appears. But when i am on a slow internet, the popup takes awhile to load. so until the popup loads i need the view in the background (where the button resides) to freeze (disable) and the user should not be able to click on any controls.
How can i disable the view/control ?
See -[UIView userInteractionEnabled]
http://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html#//apple_ref/occ/instp/UIView/userInteractionEnabled
Set
view.userInteractionEnabled = NO;
On the parent view of the controls you'd like disabled.
Set the button's enabled property to NO - if you're using UIButton or a subclass thereof.
ex.
[button setEnabled:NO];
UIView *testView = [[UIView alloc] init];
testView.userInteractionEnabled = NO;

How to add a HUD? (iOS)

I am trying to have some controls appear when you push a button and have it disappear when you press a different button. Right now the HUD is comprised of an image view, and some custom buttons in a UIView called "credits". I've managed to have it disappear using:
[credits removeFromSuperview];
How do I have it reappear?
If it's just a UIImageView, you should...
[self.view addSubview:credits];
... assuming you've not released it already. On a side note, there is a really good HUD for iOS here: http://github.com/matej/MBProgressHUD
I believe you can just set the view to be hidden
[self.view setHidden:YES];
While it's hidden, you can also update the view and then show again
[self.view setHidden:NO];
You'd better set their hidden property to whether YES or NO
This method will toggle the UIView credits hidden property
- (void) toggleCredits {
[credits setHidden:![credits isHidden]];
}

What is the meaning of UINavigation's setHidesBackButton?

- (void)setHidesBackButton:(BOOL)hidesBackButton animated:(BOOL)animated
can anyone tell me the meaning of above statement with an example?
it hides the back button in the left side of your navigation bar. but it does not prevent you from going back
please see
sethidesbackbuttonyes
Description in documentation:
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UINavigationItem_Class/Reference/UINavigationItem.html#//apple_ref/occ/instm/UINavigationItem/setHidesBackButton:animated:
Example, which hides the back button but does not animate:
[item setHidesBackButton:YES animated:NO];