开发者

UILabel on second View updates only once

开发者 https://www.devze.com 2023-02-11 02:45 出处:网络
I have a tableView, that upon clicking a cell, the tableView is resized and a second view slides into view. The second view contains more information about the selected record...

I have a tableView, that upon clicking a cell, the tableView is resized and a second view slides into view. The second view contains more information about the selected record...

NON-WORKING CODE

if(frame.size.height > 600)
{

    CGRect detailFrame = StudyDetailView.view.frame;

    self.tableview.autoresizingMask = UIViewAutoresizingNone;
    detailFrame.origin.y = (frame.size.height-200);
    detailFrame.size.height = 200;开发者_如何学JAVA
    [self.view addSubview:StudyDetailView.view];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:.7];
        self.tableview.frame = CGRectMake(0,0,frame.size.width,frame.size.height-200);
    [UIView commitAnimations];

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:.2];   
        StudyDetailView.view.frame = detailFrame;
    [UIView commitAnimations];
}

    StudyDetailView.ImageCount.text = [NSString stringWithFormat:@"%@", [[StudyListData objectAtIndex:indexPath.row] image_count]];
    [StudyDetailView.SeriesCount setText:[NSString stringWithFormat:@"%@", [[StudyListData objectAtIndex:indexPath.row] series_count]]];
    NSLog(@"This right after the view is set.. right?: %@",[NSString stringWithFormat:@"%@", [[StudyListData objectAtIndex:indexPath.row] series_count]]);

}

The ImageCount label (on the second view) only updates once, while the NSLog continues to show the correct values..

any suggestions?

WORKING CODE

CGRect frame = self.tableview.frame;
if(StudyDetailView == nil)
{
    StudyDetailView = [[StudyListDetailController alloc] initWithNibName:@"StudyListDetailController" bundle:nil];
    [self.view addSubview:StudyDetailView.view];
}
if(frame.size.height > 600)
.......


 cell.clearsContextBeforeDrawing = YES; 

try this see if it works. If not please give more details like the functions where you write the text in the UIlable


You have created a custom class StudyDetailView Where you had added two labels and made their properties. I think there's something wrong in StudyDetailView class. There's no problem in the above written code.

Can you post your code for figuring out the problem?

0

精彩评论

暂无评论...
验证码 换一张
取 消