hyperlink in alertbox in ios - objective-c

i am developing iPad5 application.
In my application i want to show hyperlink and onclick that link should open in safari.
I searched.
but i didn't get appropriate solution for this.
please help me.
thanks in advance.
for alert i am using:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"confirmation"
message:#"some string and hyperlink here"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];

for this you can add button as subview in alert and make it as hyperlink(custom button with blue text color) and on click on it you can open that link in safari.
thanks

Related

How to validate login using UIAlertView in IOS application?

I have created login for my application. I have written alert view in iOS. Here the code:
alertView = [[UIAlertView alloc] initWithTitle:#"Login"
message:#"Enter username and password"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:#"Login", nil];
alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
[alertView show];
I want to check the user name and password to allow to view next form. If the user name and password are wrong, the alert view need to pop up always.
How to pop up the alert always when the user name and password are wrong?
Any idea or reference should be appreciated.
Thanks in Advance.
In your view controller make sure you implement the UIAlertViewDelegate protocol
#interface MyCarsViewController () <UIAlertViewDelegate>
and then add this method:
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
to the view controller. This is where you can get a reference to the text fields in the alert and do your db check etc. To get a reference to the text fields use
textFieldAtIndex:
https://developer.apple.com/library/ios/documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html#//apple_ref/occ/instm/UIAlertView/textFieldAtIndex:
After you check for the correct login you can present other view controllers or display another alert depending on the login results.
Hoep this helps

how to display a multiple choice picker

i'm trying to find the correct control to display a choice selector, like the one which appears in Safari when you long press on image.
It should be some kind of UIPickerView, but it is not the same design.
Any idea is welcome.
This looks like UIActionSheet, which can be presented for example from the UITabBarController likes this:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:#"This will delete all your records. Are you sure you want to continue?" delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:#"Yes, go ahead." otherButtonTitles: nil];
[actionSheet showFromTabBar:self.tabBarController.tabBar];

In UIWebView how integrate "Add bookmark " feature

I want to integrate add book mark like safari in iphone like
here the snapshot of add bookmark feature of safari browser from iPhone i want to add same feature like it
How can i do it ?
http://xcode4all.wordpress.com/2011/05/25/web-browser-or-how-to-use-the-uiwebview-part-33/
It will be helpful
First you will need to add an alertView
sheet = [[UIActionSheet alloc] initWithTitle:#"Select Account to Delete"
delegate:self
cancelButtonTitle:#"Cancel"
destructiveButtonTitle:#"Delete All Accounts"
otherButtonTitles:#"Add bookmark", #"add to reading", #"add to home screen", nil];
// Show the sheet
[sheet showInView:self.view];
[sheet release];
that will create a popup view (AKA alertview) as your image shows above.
as for the "Add bookmark" or "add to home" it is slightly more complex, since the API does not provide you with the functions to do so, your best bet will be looking at a webview programatically launch Safari from within your app and give it the URL
read about it here: iPhone SDK - Add a "Add to Home Screen" button in a UIWebView

UIAlertView with 19 buttons

I am creating a pop up dialog box (UIAlertView). It works great, except I need to choose from 19 items, and the buttons do not automatically scroll and only five fit on the screen.
So, can I make them scroll? If not, can I put a UIPickerView in an alert view? Or, is there a better way?
Code so far:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Provider"
message:#"Please choose your provider:"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:#"AT&T",#"Verizon",#"Sprint",#"Nextel",#"T-Mobile",#"Alltel",#"US Cellular",#"Virgin Mobile",#"Metro PCS",#"Boost Mobile",#"Cricket",#"Rogers(Can)",#"Telus(Can)",#"Bell Mobility(Can)",#"Fido",#"Virgin(Can)",#"O2",#"Vodaphone",#"Meteor", nil];
[alert show];
[alert release];
You might consider using a UIActionSheet instead. It will automatically scroll when you have a lot of items.
Don't create 19 buttons. Instead, use UIPickerView.
In general, use UIActionSheet or a modal view of some sort.
In this particular case, you may be able to use the CoreTelephony framework. CTCarrier has a property carrierName that is supposed to return the something similar to what you are asking for (as long as the device is connected to a cellular network).

iPhone keyboard popup problem in UIAlertView

I want to accept password using an alert view. Following is the code I am using. But I am unable to figure out why does the keyboard pop out two times instead of once? Any ideas?
UIAlertView *passwordAlert = [[UIAlertView alloc]
initWithTitle:#"Enter Password" message:#""
delegate:self cancelButtonTitle:#"Cancel"
otherButtonTitles:#"Submit",nil];
[passwordAlert addTextFieldWithValue:#"" label:#"Password"];
UITextField *textfield = [passwordAlert textFieldAtIndex:0];
textfield.secureTextEntry = YES;
[passwordAlert setTag:10];
[passwordAlert show];
Not entirely sure where addTextFieldWithValue is defined but you may want to check your .xib file to make sure you didn't place double views on the "stage" as in this post:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/1479-uialertview-popping-up-twice.html
Also, check out this post. Looks like you may have to "tell the text field to become first responder before showing the alert view, you'll wind up with two keyboards":
http://www.iphonedevsdk.com/forum/iphone-sdk-development/2753-new-info-adding-text-fields-alerts.html#post14701