[英]Type Cast UIView Warning
I keep getting a warning that the UIView may not respond to selectedSegmentIndex. 我一直警告UIView可能不会响应selectedSegmentIndex。 I tried type casting, but I could not get rid of the warning.
我尝试了类型转换,但我无法摆脱警告。 I'm assuming I did the cast incorrectly.
我假设我做错了。
What is the proper way to type cast this, to avoid the warning? 输入此类型的正确方法是什么,以避免警告?
- (IBAction)segmentedControlIndexChanged:(id)sender
{
switch ([[[[self.view viewWithTag:100] viewWithTag:202] viewWithTag:203] selectedSegmentIndex]) {
case 0:
// code here
break;
case 1:
// code here
break;
default:
break;
}
}
Try with this: 试试这个:
switch ([ (UISegmentedControl*)[[[self.view viewWithTag:100] viewWithTag:202] viewWithTag:203] selectedSegmentIndex]) {
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.