iphone - How to create ui alert view in .pch in objective c -


#define kcustomalert @"uialertview *alert=[[uialertview alloc]initwithtitle:@"alert back" message:msg delegate:self cancelbuttontitle:@"ok" otherbuttontitles: nil];[alert show];" 
  1. how call alert in view controller class?

declare macro in pch file:

 #define kcustomalert() [[[uialertview alloc] initwithtitle:@"alert title" message:@"alert message" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil, nil] show] 

macro call: kcustomalert();

alert macro parameter:

#define kcustomalertwithparam(title,msg) [[[uialertview alloc] initwithtitle:title message:msg delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil, nil] show]  kcustomalertwithparam(@"this title",@"this message"); 

alert macro parameters , target(for use of: uialertview delegate methods)

please set uialertviewdelegate controller.  #define kcustomalertwithparamandtarget(title,msg,target) [[[uialertview alloc] initwithtitle:title message:msg delegate:target cancelbuttontitle:@"ok" otherbuttontitles:nil, nil] show]  kcustomalertwithparamandtarget(@"this title",@"this message",self); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -