Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jalju

macrumors newbie
Original poster
Jun 16, 2009
1
0
-(void) mymethod{
UIButton *refreshbutton=[UIButton buttonWithType:UIButtonTypeCustom];
[refreshbutton setFrame:CGRectMake(15.0f, 330.0f, 150.0f, 32.0f)];
NSString *myvalue=[[NSString alloc]initWithString:mad:"YES IT IS OKy |"];
[refreshbutton setTitle:mad:"Refresh" forState:UIControlStateNormal];
[refreshbutton addTarget:self action:mad:selector(showvalue: myvalue) forControlEvents:UIControlEventTouchUpInside];
[self.window addSubview:refreshbutton];
}

-(void) showvalue:(id)sender{

// here how to displs the value of "myvalue" ? myvalue is define in mymethod . i mean first method..
}

pls rectify the error in this code...
 
1) please use code-tags in this forum
2) I think spaces are not allowed in selectors. also, I can't imaginge
[[NSString alloc]init
is working without a space, but I havn't tried.
 
Code:
[refreshbutton addTarget:self action:@selector(showvalue:) forControlEvents:UIControlEventTouchUpInside];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.