About
Home > Tutorials Home > Ios > UIButton Example in iOS

UIButton Example in iOS

Published on October 17, 2019 7:57:14 PM

alert-view


This Application helps you to create a Button Example

Step 1 : Open the XCode and create a new Single View Based Application template. Give the application name "Button Example". Copy this Code to the ViewController.h and hook up the properties with appropriate control.
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *txtName;
- (IBAction)displayAlert:(id)sender;
@end
Step 2 : Copy the Following Code into your ViewController.m File.
#import "ViewController.h"
@implementation ViewController
@synthesize txtName;
- (IBAction)displayAlert:(id)sender
{
	UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"System Message" message:[NSString stringWithFormat:@"Welcome, %@",[txtName text]] delegate:nil cancelButtonTitle:@"Okey" otherButtonTitles:nil, nil];
    [alert show];
}
@end
ALL COMMENTS (2)
Abhishek Bedre 2017-03-28 17:25:15
I have implemented my own "jarvis"....thanks to this example.        
2019-01-03 13:22:19
It is working fine in desktop but not working in android mobile