Type Cast UIView Warning

I keep getting a warning that the UIView may not respond to 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;
    }
}

试试这个:

switch ([ (UISegmentedControl*)[[[self.view viewWithTag:100] viewWithTag:202] viewWithTag:203] selectedSegmentIndex]) {
...
链接地址: http://www.djcxy.com/p/26988.html

上一篇: iCloud和GEOResourceManifestServerRemoteProxy:与地理位置警告的连接丢失

下一篇: 类型演员UIView警告