I have a UIButton in a custom UITableViewCell, when I press the button it will post data to my server using AFNetworking,in the success block I set a new button title, but it doesn't work.
In CutomTableViewCell I use a protocol so I can respond button click:
@implementation SubjectReplyCell
- (IBAction)btnReplyPressed:(UIButton *)sender {
    if (self.delegate && [self.delegate respondsToSelector:@selector(postData:atIndex:)]) {
        [self.delegate postData:self atIndex:sender.tag];
    }
}
@end
Then I implementation the delegate and post data to server:
@implementation BBSDetailsController
- (void)postData:(SubjectReplyCell *)cell atIndex:(NSInteger)idx {
    urlString = [API_HOST stringByAppendingString:BBS_PRAISE_OPPOSITION];
    __weak typeof(SubjectReplyCell) *weakCell = cell;
    [requestManager POST:urlString parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
        if ([responseObject[@"returnode"] isEqualToString:@"success"]) {
            //it doesn't work
            [weakCell.btnReply setTitle:@"newTitle" forState:UIControlStateNormal];
            [weakCell setNeedsLayout];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    }];
}
But if I set title out of the block it work well:
- (void)postData:(SubjectReplyCell *)cell atIndex:(NSInteger)idx {
    urlString = [API_HOST stringByAppendingString:BBS_PRAISE_OPPOSITION];
    //it work
    [cell.btnReply setTitle:@"newTitle" forState:UIControlStateNormal];
    [requestManager POST:urlString parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
        if ([responseObject[@"returnode"] isEqualToString:@"success"]) {
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    }];
}
 
     
     
    