2015-01-10 40 views
0

我的應用程序中有一個PFQueryTableViewController。如果它是一個控制器的根視圖,那很好。但是,如果我將它推到另一個視圖上,則會有一條奇怪的線穿過每個單元格的頂部。PFQueryTableViewController在推送時有行通過單元格

- (id)initWithCoder:(NSCoder *)aDecoder 
{ 
    self = [super initWithCoder:aDecoder]; 
    if (self) { 

     // The className to query on 
     self.parseClassName = @"Prayers"; 

     // Whether the built-in pull-to-refresh is enabled 
     self.pullToRefreshEnabled = YES; 

     // Whether the built-in pagination is enabled 
     self.paginationEnabled = YES; 

     // The number of objects to show per page 
     self.objectsPerPage = 20; 

    } 
    return self; 
} 
- (PFQuery *)queryForTable { 
    PFQuery *query = [PFQuery queryWithClassName:self.parseClassName]; 

    // If no objects are loaded in memory, we look to the cache first to fill the table 
    // and then subsequently do a query against the network. 
    if (self.objects.count == 0) { 
     query.cachePolicy = kPFCachePolicyCacheThenNetwork; 
    } 

    [query orderByDescending:@"createdAt"]; 

    return query; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView 
     cellForRowAtIndexPath:(NSIndexPath *)indexPath 
         object:(PFObject *)object 
{ 
    static NSString *CellIdentifier = @"Cell"; 

    Cell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[Cell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; 
    } 
    self.theObject = object; 

    // Configure the cell to show todo item with a priority at the bottom 
    cell.profileName.text = object[@"Title"]; 
    cell.contentLabel.text = object[@"Request"]; 
    cell.firstName = object[@"FirstName"]; 
    cell.lastName = object[@"LastName"]; 
    cell.iostoken = object[@"DeviceID"]; 
    cell.request = object[@"Title"]; 
    cell.prayerObject = object; 
    PFFile *thumbnail = object[@"ProfilePic"]; 
    cell.profilePic.image = [UIImage imageNamed:@"[email protected]"]; 
    [cell.commentButton addTarget:self action:@selector(didTapCommentButtonAction:) forControlEvents:UIControlEventTouchUpInside]; 
    [cell.commentButton setTitle:@"Share" forState:UIControlStateNormal]; 
    [cell.commentButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 
    [cell.commentButton setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted]; 
    [thumbnail getDataInBackgroundWithBlock:^(NSData *imageData, NSError *error) { 

     UIImage *thumbnailImage = [UIImage imageWithData:imageData]; 
     UIImageView *thumbnailImageView = [[UIImageView alloc] initWithImage:thumbnailImage]; 

     cell.profilePic.image = thumbnailImage; 

    }]; 
    NSString *dates = object[@"dateMade"]; 
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 
    [formatter setDateFormat:@"MMM_dd_yyyy"]; 
    NSDate *datefromstring = [formatter dateFromString:dates]; 
    NSDateFormatter *formatter2 = [[NSDateFormatter alloc] init]; 
    [formatter2 setDateFormat:@"MMM dd, yyyy"]; 
    cell.dateLabel.text = [formatter2 stringFromDate:datefromstring]; 
    UIFont *cellFont = [UIFont fontWithName:@"Verdana-Bold" size:15]; 
    UIFont *cellFont2 = [UIFont fontWithName:@"Verdana-Bold" size:12]; 



    return cell; 
} 

只要有這個作爲根視圖呈現這樣的:

enter image description here

如果我這樣從另一種觀點認爲目前它:

-(void)myPrayers { 
    BlogView1 *prayers = [[BlogView1 alloc] init]; 
    [self.navigationController pushViewController:prayers animated:YES]; 

} 

它看起來像這樣:

enter image description here

+0

只是一個側面說明:您的標籤圖標可能是因爲您未將圖片的文件名稱添加到支持視網膜顯示的圖片名稱而導致圖片化。 [見這裏](https://developer.apple.com/library/ios/qa/qa1686/_index.html) – soulshined

回答

1

這看起來像一個UITableViewCellSeperatorStyle屬性需要被設置爲UITableViewCellSeparatorStyleNone ...

[_table setSeparatorStyle:UITableViewCellSeparatorStyleNone]; 

OR

設置你的UITableViewCell的分離顏色,清除顏色

[_table setSeparatorColor:<#(UIColor *)#>] 
+0

它是否解決了這個問題?順便說一句,我喜歡你的細胞:) – jsetting32