Reputation: 3
I am creating bunch of subviews of type STlater in a UIView (STlater is also of type UIView)
and there is UIButton with below click event, i want to loop thru all the subviews and setup some values but it gives SIGABRT error. Please help.
enter code here
-(IBAction)nextClick:(id)sender
{
for (STlater *stv in self.subviews) {
//stv.lblTime.text=@"7:00";
[stv setInitValues:@"hello"];
}
}
Upvotes: 0
Views: 353
Reputation: 1794
I think you should check that stv is an instance of STlater, as the UIButton instance in subviews probably doesn't have the setInitValues: method.
for (STlater *stv in self.subviews) {
if ( [stv isKindOfClass:[STLater class]] ) {
[stv setInitValues:@"hello"];
}
}
Upvotes: 1