I saw someone passing arguments by a button s tag as follow. how could this work? and is it safe to do like this ?
NSCustomClass* cls = [[NSCustomClass alloc] init:@"",@"",@""];
[button setTag:(int) cls];
- (void)OnClick:(id)sender
{
NSCustomClass* cls = (NSCustomClass*)[sender tag];
// to do something with the "cls".
[cls release];
}
事实上,我没有取得令人望而却的成果。
它以这种方式通过国家情报和安全局等论点来进行罚款。
你们能否告诉我,为什么这是一个坏的想法?