简体   繁体   中英

UISwitch and UISegmentedControl disappear in cell on iOS 8.1.1

I get a strange issue when using my app on iOS 8.1.1 and 8.1.2 (iPhone 6). Some components ( UISwitch and UISemgentedControl ) in my menu cells have disappeared. I can't reproduce it on simulator, since I did not find iOS 8.1.1 sim on xcode 6.1 or 6.1.1 (GM seed), and it works well on iOS 8.1 (both simulator and device)

In my UITableView I get many differents cells type, and I load them like this in tableview:CellForRow:AtIndexPath:

[[NSBundle mainBundle] loadNibNamed:@"SubMenuCellSwitch" owner:self options:nil];

[[NSBundle mainBundle] loadNibNamed:@"SubMenuCellSegment" owner:self options:nil];

I'm using Autolayout in the cells'xib, but I still get the same issue if I remove it. Every subviews of my cells are visible ( UIImageView and UILabel ) except the switch and segmentedControl !

Does anyone get a similar issue on iOS 8.1.1 ? or have a possible answer ?

The error seems to be that since iOS 8.1.1, I'm not entering one of my if statement.

The cast on NSNumber object fails.

When debugging, I got this on iOS 8.1 :

(lldb) po quality
{
    segment = 1;
    title = "Quality";
}
(lldb) p (BOOL)[quality valueForKey:@"segment"]
(BOOL) $0 = YES
(lldb) p (BOOL)[[quality valueForKey:@"segment"] boolValue]
(BOOL) $1 = YES

But here is what I got on iOS8.1.1

(lldb) po quality
{
    segment = 1;
    title = "Quality";
}
(lldb) p (BOOL)[quality valueForKey:@"segment"]
(BOOL) $2 = NO
(lldb) p (BOOL)[[quality valueForKey:@"segment"] boolValue]
(BOOL) $3 = YES

and my if statement was :

if ([quality valueForKey:@"segment"]) {

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM