iPhone Popup dialog hidden behind UIActionSheet - iphone

I have a UIActionSheet that displays various buttons, one of which posts a tweet to Twitter. To do so, the app has to request permission to access the user's Twitter account that they set in the settings on iOS 5. The problem is this popup gets hidden behind the UIActionSheet, like so:
screenshot http://dl.dropbox.com/u/51070/actionsheet.png
How can I get it to show above the action sheet? I've also tried dismissing the action sheet through dismissWithClickedButtonIndex:animated before calling the tweet function, but this problem still occurred.
Thanks!

Try calling your tweet method like this:
[self performSelector:#selector(myTweetMethod) withObject:nil afterDelay:0.1];
This should give the action sheet enough time to dismiss before invoking the tweet code.

Related

Button touchupinside action done automatically on view appear?

I want Button action done automatically when a view load. Is it possible?
The other answers are correct in that setting the action that your button is tied to, then in your viewDidLoad:, call that function will work. I will just chime in with another method for others info.
You can send it a control event telling it that the button should act as if it has been pressed:
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
This is useful when you do not have an outlet to the button. For instance, I created an app where the user can press on a web view and launch a youtube video. It was also required that if the user presses a "video" button, then the same youtube video would launch. Basically, I had to fire a press event on the web view. So i searched through its views and found the button, from there I called the above line, and the webview pushes a video view controller for the youtube video.
Certainly Yes. Call your method as
assuming your method declaration as
-(IBAction)yourButtonTapEvent:(id)sender;
[self yourButtonTapEvent:nil];
Yes, in your viewDidAppear method, just call the action you are providing for that specific button.
- (void)viewDidAppear:(BOOL)animated
{
[self yourButtonAction:nil];
[super viewDidAppear:animated];
}

ABPersonViewController delete button warning

I have an iPhone application that I use the ABPersonViewController and I allow delete.
The thing is that the application is a TabBar application and when i use the regular delete method I get this warning:
Presenting action sheet clipped by its superview. Some controls might not respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:].
the problem is that when I try to press on the "Cancel" of the delete, it does not work!
I want the action sheet to pop up from the TabBar, How do I do that?
this is the code:
if ([personController respondsToSelector:#selector(setAllowsDeletion:)])
[personController setAllowsDeletion:YES]; //CAN CAUSE THE APPLICATION TO BE DENIED FROM THE APP-STORE
To display an action sheet from a tab bar, you can call the following within the view controller that is presenting it: [actionSheet showFromTabBar:self.tabBarController.tabBar];
This answer is explained in this post.

Dismissing a UIAlertView

I put an in app purchase into my app, and when the user taps a button, the purchase is started. So basically, they tap the button, and then depending on the speed on their Internet connection, they could be waiting for up to ten seconds until a new alert view comes up asking if they would like to buy the product. The user will probably tap the button multiple times since nothing came up, and then multiple purchase alert views will come up. Additionally, this could maybe be seen by the user as an app bug. In the end, this is a problem.
I want an alert view to come up with a spinning wheel that says "Loading..." when the users taps the buy button. Now my problem is, how do I get that to dismiss when the new alert view comes up asking the user if they want to buy the product?
if ([UIAlertView alloc] that says: #"whatever Apple's alert view says")
{
//dismiss the "Loading..." alert view here
}
I doubt that would work, so any input is appreciated. Thanks!
You need to have access to that alertview. You can do this. Create a alertview instance var in app delegate and when you want to show loading initialize that instance var assign to your property and when you want to dismiss just call
[alertViewinstance dismissWithClickedButtonAtIndex:0];
Write this piece of code in a method in appDelegate. Hope you get the idea. If not let me know I'll post the sample code here.

I want eject any user action until a function is done, iphone app!

i'm writing an iphone app integrate with webservice.When user wait to login on web,I want eject any user action until login is done. Please help me! thanks!
One way would be to pop up a modal view controller using presentModalViewController. Another way would be to use [[UIApplication sharedApplication] beginIgnoringInteractionEvents]
If you don't multithread your code the user shouldn't be able to interact with your UI while you're getting and sending data.
Alternatively you could present a semitransparent loading screen over the whole UI -while loading- that intercepts every touch event.

How can I automatically click cancel when an OK-Cancel alert pops up in the UIWebView?

I'm having a problem with my UIWebView for my iPhone App... I am getting an alert thrown up with OK-Cancel button options, and I don't want the user to see this... But the web page automatically pops up an alert. How can I programmatically detect the Alert was thrown up and how do I click the cancel button on the alert?
Thanks,
Matt
In a class derived from UIWebView, implement these methods:
- (void)webView:(id)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(id)frame {}
- (BOOL)webView:(id)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(id)frame { return NO; }
While not strictly documented, you are not actually calling anything so it may be accepted.
Otherwise, you will have to find the javascript in the loaded page that is putting up the alert and remove it.