WEB开发网
开发学院手机开发iPhone 开发 iPhone常用控件、UIActionSheet、UIAlertView 阅读

iPhone常用控件、UIActionSheet、UIAlertView

 2010-12-18 08:05:25 来源:WEB开发网   
核心提示:YES; break; case kSegmentIndex_Button:leftSwitch.hidden = YES; rightSwitch.hidden = YES; doSomethingButton.hidden = NO; break; }}- (IBAction) buttonPressed: (id
YES; break; case kSegmentIndex_Button:

leftSwitch.hidden = YES; rightSwitch.hidden = YES; doSomethingButton.hidden = NO; break; }}- (IBAction) buttonPressed: (id)sender{ UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure?"

delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Yes,I'm sure." otherButtonTitles:nil]; [actionSheet showInView:self.view]; [actionSheet release];}- (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview.

[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.

}

- (void)viewDidUnload { // Release any retained subviews of the main view.

// e.g. self.myOutlet = nil;

self.leftSwitch = nil; self.rightSwitch = nil; self.doSomethingButton = nil; [super viewDidUnload];}- (void)dealloc { [leftSwitch release]; [rightSwitch release]; [doSomethingButton release]; [super dealloc];}#pragma mark -

#pragma mark ActionSheet Delegate Methods

- (void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{ if (buttonIndex != [actionSheet cancelButtonIndex]) { NSString *text = [[NSString alloc] initWithFormat:@"test alert"]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Something was done." message:text delegate:self cancelButtonTitle:@"OK!" otherButtonTitles:nil]; [alert show]; [alert release]; [text release]; }}//- (void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

//{

// NSLog(@"%d",buttonIndex);

//}

@end

上一页  1 2 3 4 5 

Tags:iPhone 常用 控件

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接