I have 3 buttons, when you click on any one of them, a corresponding UIImageView of a paper card pops up. In the interface builder the papercard is "in front" of the buttons so you can't see them when the card is visible (a good thing).
Problem is, I noticed that even though you can't see the buttons which are still behind the paper card UIImageView you still end up pressing those buttons if you click on the spot where they'd be, as though you're pressing right through the paper card.
So I need a function that will make those buttons untouchable while that paper card is visible, and remain untouchable until I hit the back button to remove the paper card and go back to the view three buttons. Is there such thing as a "disable button" code?
OK so google UIButton and you'll get to the docs here UIButton Class Reference.
Now scan the docs for anything that might work - (mmm nope)
Nope OK let's look at the superclass by following the link in the UIButton docs, which says the superclass is UIControl
Excellent there is a property called enabled - this looks like something you could use.
self.myButton.enabled = NO;
Related
I want to display some hint to user when a user touches the button in iPhone native application, just like tooltip in web applications.
I have a large number of TextField that should be associated with info button to let the user know the detail description about the data captured in that TextField.
Can any one post steps to achieve this?
Agreed with Justin, but if you really had to:
Add an action to the UIButton that launches on the Touch Down event, e.g. UIButton * button = [[UIButton alloc] init]; [button addTarget:self action:#selector(doSomething:) forControlEvents:UIControlEventTouchDown];
Define the 'doSomething' action method as showing a custom 'tooltip' view anchored to the button location. The UIButton which was touched will be passed to the action method, from which you can access its location and so know where to anchor the tooltip.
If this all sounds laborious, check out "Is it possible to show a tooltip in an iOS app?", which links to CMPopTipView (https://github.com/chrismiles/CMPopTipView#readme), a useful package which will do it all for you. Haven't used it myself, though.
I'm not sure how to achieve this, but it sounds like a terrible User Interface idea for a mobile app.
I say that because tooltips in classic applications typically happen on mouse hover. Mobile interfaces don't have an equivalent gesture. When you touch a button, it's like a click.
If you look at most mobile applications that need to explain something to the user, it's usually done through visual elements that show up when the app loads (they'll point to different buttons, explain what they're for, and then go away after the first time the button is used).
I currently have a map view in my app that is locked so that the user can't interact with it (i.e. scroll, zoom etc.), however I want to make it into a UIButton. The idea being the the can press the map view and it will call a function, the same way pressing a UIButton does.
I've had a look around online for ideas on how to achieve this but I haven't found anything yet. I tried making a UIButton over the top of the map view but I can't seem to make it invisible. I also tried linking an IBAction to the map view, however the option to link it doesn't appear in the connections inspector (as I expected to be honest - shot in the dark!).
Is there any way to achieve this effect?
You can place a UIButton over the map, just like you tried before. But to make it invisible, change the button type from Round Rect to Custom. This will make the button invisible unless you explicitly add an image to the button.
-Cheers
I've developed an iPhone App and most of it is accessible but I have an issue with one thing I do.
When the user clicks the settings button in the App (it has a main menu with a bunch of buttons for various Applications) I add a UIView on the top and and darken the background screen. Unfortunately for a blind person this UIView doesn't become "active", ie they are still navigating around the background screen.
I initially added the UIView using addSubview: and then tried insertSubview: atIndex: but neither have operated as expected.
Edit: Further information there are text fields and a button on this screen, perhaps I could instead make one of them active or something?? No idea how I would do this though.
How about using becomeFirstResponder? It makes the control receiving this message active and the receiver of input. For UITextView etc. it brings up the keyboard.
I didn't get what you are saying, but I thought there may be problem with the view added on the top.
Do one thing, if you added the view using interface builder then select the view and click on Layout menu in the Menu bar and select "Send to Back".
or else if you add that through code, then write code as
[self.view sendSubViewToBack:addedView];
Regards,
Satya
how can i just change the color,of a button when i set the focus on the button in iphone.
I mean to say , for example we have 5 buttons, and i am just setting the focus on each of the button. i want those buttons to be higlighted with different color.
but when press or touch up inside the utton, the navigation is made to the respective forms, that is set for that button.
you can write method, for example, let it be
- (void) changeButtonState:(UIButton*) buttonToChange;
then you can call it in your onBtnClk method for button you need. in that method you can change image for your button's UIControlStateNormal mode. and if I understand right, you can use toolbar or tabbar instead of buttons.
Guess you have already asked this issue differently here..
But have you checked the answer?? You can use any of those methods at your will!
The iPhone Mail application has an edit button in the navigation bar. Tapping that button shows a delete button in the toolbar and shows checkbox controls in the table cells. Tapping one or more checkboxes then tapping the delete button causes the checked messages to be deleted.
How can I add similar functionality to my own code?
Here's a screenshot of the effect I'm looking for:
screenshot of spam folder with some messages checked http://www.freeimagehosting.net/uploads/add199aa62.png
UINavigationBar has a UINavigationItem with a leftBarButtonItem and a rightBarButtonItem.
To set your edit button you init a bar button item with the style: UIBarButtonSystemItemEdit.
Follow the delete button example here:
http://dragonforged.com/devblog/?p=34
#DavidSowsy's answer only shows how to draw a red button.
For those actually interested in selecting multiple rows in a UITableView, I have found 2 ways to do it:
The easy way that involves undocumented APIs and will probably make your app crash in the next
OS update.
The proper one, that is a bit more work but works well and you won't have to think about it again.
For my project, I chose the latter.