I am building an app on Xcode 5 that targets iOS 6+.
I'm having trouble building up my table view with custom cells. Interestingly, it was working great until I updated to Xcode 5.0.2 today (I have no idea what changed). My table view did draw plain white (screenshot below) before too when I messed with the white navigation bar style (I have no idea how they also link to each other either) that came with iOS 7 SDK. Anyway, when I removed the light status bar option from my code, my table view used to draw normally, though I have black status bar. Today, after installing Xcode 5.0.2, I've built the same project without changing any code, and my table view now draws plain white on iOS 7 (both device and simulator). When I switch to iOS 6, it displays perfectly (both device and simulator). I've tried cleaning the build folder, cleaning the derived data folder, restarting Xcode/simulator/device, but nothing has changed. Also, the app started to display white status bar which didn't before updating Xcode. I know that they should be irrelevant but I'm having hard time developing my app now. The cells receive all the touch events, the table view does scroll, I'm getting all the NSLog
s at the output and I can see the scroll bar when I scroll down. It just doesn't draw. I had custom drawRect:
code in my custom cells. After seeing UITableViewCell custom CG drawing iOS 7 and subclassed UITableViewCell - backgroundView covers up anything I do in drawRect I commented out that code, but it didn't help. Here is what I'm getting on iOS 7 (selected cell in gray):
And here is the same app on iOS 6 (blurred text/images for privacy):
Here is the code for -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
:
MyFriendViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"friendTableCell"];
if(!cell){
cell = [[[NSBundle mainBundle] loadNibNamed:@"MyFriendViewCell" owner:self options:nil] lastObject];
}
/* some code that sets text fields/images */
[...]
return cell;
I have a XIB file (with only one object, my custom cell class) and a class corresponding to the cell. I've registered my cell in the beginning:
[self.tableView registerNib:[UINib nibWithNibName:@"MyFriendViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"friendTableCell"];
I've checked the cell
in the method, dequeue never returns nil
anyway.
UPDATE: I've also realized that my app uses 100% CPU when idle on this screen on both iOS 6 (even though it runs correctly) and on iOS 7).
IMPORTANT: The question has been answered, but to any of you who were wondering about drawRect:
, the problem had nothing to do with that, I'm still using custom drawRect:
and it works perfectly.
setcontentview
backgroundColor
to clear color
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With