iPhone Programming: Custom Methods with Parameters

Опубликовано: 11 Март 2026
на канале: MilmersXcode
1,554
14

I teach you how to show a UIAlertView using a custom method with parameters.

-(void)createUIAlertViewWithTitle:(NSString *)title andMainText:(NSString *)mainText withCancelButton:(NSString *)cancelButton andOtherButtons:(NSString *)otherButton;

-(void) createUIAlertViewWithTitle:(NSString *)title andMainText:(NSString *)mainText withCancelButton:(NSString *)cancelButton andOtherButtons:(NSString *)otherButton
{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:title
message:mainText
delegate:self
cancelButtonTitle:cancelButton
otherButtonTitles:otherButton, nil];
[alert show];
[alert release];
}

[self createUIAlertViewWithTitle:@"Title" andMainText:@"Main Text" withCancelButton:@"Cancel" andOtherButtons:@"Other"];

NSInvocation Tutorial:    • iPhone Programming: NSInvocation - Storing...  

Twitter:   / failcakeapps  
Apple Developer Center: http://developer.apple.com/devcenter/...
Website: http://failcake.webs.com/
Channel:    / milmersxcode