-(void) loadView
{
UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
view.backgroundColor =[UIColor lightGrayColor];
CGRect frame =CGRectMake(10, 15, 300, 20);
UILabel *label = [[UILabel alloc] initWithFrame:frame];
label.textAlignment =UITextAlignmentLeft;
label.backgroundColor = [UIColor whiteColor];
label.font = [UIFont fontWithName:@"Verdana" size:20];
label.text = @"This is Label";
label.tag = 1000;
frame =CGRectMake(10, 50, 300, 50);
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = frame;
[button setTitle:@"This is a button" forState:UIControlStateNormal];
button.backgroundColor = [UIColor clearColor];
button.tag = 2000;
[button addTarget:self
action:@selector(buttonClicked:)
forControlEvents:UIControlEventTouchUpInside];
[view addSubview:label];
[view addSubview:button];
self.view = view;
[label release];
}
-(IBAction) buttonClicked:(id) sender{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Button Clicked"
message:@"Hello"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
0 件のコメント:
コメントを投稿