用到UIAlertView,以后开发应该能用到记录之
两个例子,
第一个
-(IBAction)buttonPressed:(id)sender
{
NSString *favouriate = [sender titleForState:UIControlStateNormal];
NSString *alertViewText = [[NSString alloc] initWithFormat:@"You choose the %@ as your favouriate Apple computer",favouriate];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Favoriate Mac!"
message:alertViewText
delegate:nil
cancelButtonTitle:@"Go back"
otherButtonTitles:@"Yes!", nil];
[alert show];
[alert release];
}

第二个
-(IBAction)buttonPressed:(id)sender
{
NSString *favouriate = [sender titleForState:UIControlStateNormal];
NSString *alertViewText = [[NSString alloc] initWithFormat:@"You choose the %@ as your favouriate Apple computer",favouriate];
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"favoriate Text" message:alertViewText delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}

没有评论:
发表评论