UIButton *b =[UIButton buttonWithType:UIButtonTypeInfoLight];
b.frame =CGRectMake(50, 50, 50, 50);
[b addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
[self.window addSubview:b];
return YES;
}
-(void)click
{
int temp =arc4random() %34 +1;
NSString *str = [NSString stringWithFormat:@"请学号%d的同学回答问题!",temp];
//现实控件
UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"友情提示" message:str delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alert show];
[alert release];
}