1
지금 트위터 앱을 만들고 IFTweetLabel을 사용하고 있습니다. TableViewCell Subclass를 만들었지 만 Run it을 실행하면 label dosent가 나타납니다. 여기 UITableViewCell의 IFTweetLabel 하위 클래스가 표시되지 않습니다.
은 .H입니다 :#import <UIKit/UIKit.h>
#import "IFTweetLabel.h"
@interface twitterTextCell : UITableViewCell
@property (strong, nonatomic) IFTweetLabel *customtextLabel;
@end
그리고 여기에 구현 한 것입니다 :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
twitterTextCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[twitterTextCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSDictionary *tweet = [self.timeLineData objectAtIndex:indexPath.row];
if ([tweet objectForKey:@"text"] != nil) {
NSString *allText = [[tweet objectForKey:@"text"] stringByDecodingHTMLEntities];
cell.customtextLabel.numberOfLines = 4;
cell.textLabel.numberOfLines = 4;
cell.customtextLabel.text = allText;
cell.textLabel.text = allText;
cell.customtextLabel.linksEnabled = YES;
NSDictionary *whoPostedTweet = [tweet objectForKey:@"user"];
cell.detailTextLabel.text = [whoPostedTweet objectForKey:@"name"];
NSURL *imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@", [whoPostedTweet objectForKey:@"profile_image_url"]]];
[cell.imageView setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
cell.backgroundColor = [UIColor clearColor];
[cell.imageView.layer setCornerRadius:7.0f];
[cell.imageView.layer setMasksToBounds:YES];
return cell;
} else {
[self getTwitterData];
NSLog(@"nil called(else) ");
return cell;
}
return cell;
}
: 여기
#import "twitterTextCell.h"
@implementation twitterTextCell
@synthesize customtextLabel;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
customtextLabel.backgroundColor = [UIColor orangeColor];
self.customtextLabel.frame = CGRectMake(240, 60, 345, 109);
[self addSubview:customtextLabel];
NSLog(@"Custom Label Text: %@", customtextLabel.text);
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(UILabel *)textLabel
{
return nil;
}
가 tableviewdelegate에 cellforrow에있는 코드 이 모든 후 이미지 및 세부 텍스트보기 만 표시됩니다. 텍스트가 정상적으로 표시되지만 IFTweetLabel이 아니기 때문에 기본 텍스트 뷰를 제거합니다. 또 다른 질문은 IFTweetLabel 아래에 있도록 detailtextabel의 위치를 변경하는 방법입니다. 아무거나는 중대하게 평가된다, 나는이 문제점 전부에 도움을 필요로한다.
감사합니다. Soooooo Much !!!!!! – virindh