Why is it not possible to change the Label.text of the following objects? (timeLabel, tweetOnTimelineTextfield, autorlabel)?
If I want to change values of these objects ("cell.timeLabel", "cell.autorlabel") it doesn't work!
I created a Class called TimelineTableViewCell (for my Custom Cell) and linked it in storyboard.
The main code of the PFQueryTableViewController is in the TimelineTableViewController.
Here is the code:
TimelineTableViewCell.h:
#import <UIKit/UIKit.h>
@interface TimelineTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UITextView *tweetOnTimelineTextfield;
@property (weak, nonatomic) IBOutlet UILabel *autorLabel;
@end
TimeLineViewController.m:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
static NSString *CellIdentifier = @"Cell";
TimelineTableViewCell *cell = (TimelineTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell)
{
cell = [[TimelineTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier];
}
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEEE, MMMM d yyyy"];
NSDate *date = [object createdAt];
// Configure the cell
cell.textLabel.text = [object objectForKey:@"content"];
cell.detailTextLabel.text = [NSString stringWithFormat:@"Priority: %@", [object objectForKey:@"createdAt"]];
return cell;
}
TimeLineViewController.h:
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
@interface TimelineTableViewController : PFQueryTableViewController
@end
Thank you guys, now it works! The intellisens didn't show me the labels of the other class(if I tried cell.a -> the only propose was cell.auto(?!). However now I tried cell.autorLabel.text and it works perfectly! Thank you!
Go to your TimelineTableViewCell.m file and synthesize the properties of the custom cell.
So you'll have this
@implementation TimelineTableViewCell
@synthesize timeLabel,tweetOnTimelineTextfield,autorLabel;
You should be good to go!
Enjoy!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.