TeehanLax / UITableViewCell-Swipe-for-Options

A reproduction of the iOS 7 Mail app's swipe-to-reveal options
http://www.teehanlax.com/blog/reproducing-the-ios-7-mail-apps-interface/
MIT License
615 stars 99 forks source link

Shows empty cell #7

Open sanketfirodiya opened 10 years ago

sanketfirodiya commented 10 years ago

My implementation does not show content in the cell. Do I need to use a container view controller necessarily? Or any ideas what else I could be missing?

Thanks in advance!!

ashfurrow commented 10 years ago

Hi! Can you post your implementation file so I can help diagnose the problem?

sanketfirodiya commented 10 years ago
    static NSString *CellIdentifier = @"TLSwipeForOptionsCell";
    cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = (TLSwipeForOptionsCell*)[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    UILabel *itemName = (UILabel*)[cell viewWithTag:1];
    [itemName setText:name];

    UILabel *itemDescription = (UILabel*)[cell viewWithTag:2];
    [itemDescription setText:description];

The tableViewCell displays the swipe behavior. Also if I set cell.textLabel.text = name, the text shows up. Only when I try to display the elements from my storyboard using tags, the cell is blank.

sanketfirodiya commented 10 years ago

I have also tried using this approach in the sample app and experience the same issue. Basically the views inherited from storyboard do not show up.

However, when I swipe the cell beyond 50% to the left, the content can be seen underneath. I have attached the screenshot. tlswipeforoptionscell_bug