Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- NSString *identifier = @"FeedCell";
- FeedDetailCell *cell = (FeedDetailCell*)[tableView dequeueReusableCellWithIdentifier:identifier];
- if (cell==nil) {
- cell = (FeedDetailCell*)[[[NSBundle mainBundle] loadNibNamed:@"FeedDetail" owner:nil options:nil] objectAtIndex:0];
- }
- [tableView setSeparatorColor:[UIColor grayColor]];
- switch (indexPath.section) {
- case 0:
- if (indexPath.row == 0) {
- cell.nameLabel.text = @"Telephone";
- [cell.detailLabel setText:[_feedDictionary valueForKey:@"mobile"]];
- }
- else {
- cell.nameLabel.text = @"Mobile";
- [cell.detailLabel setText:[_feedDictionary valueForKey:@"iPhone"]];
- }
- break;
- case 1:
- cell.nameLabel.text = @"E-mail";
- [cell.detailLabel setText:[_feedDictionary valueForKey:@"Email"]];
- break;
- case 2:
- cell.nameLabel.text = @"address";
- [cell.detailLabel setText:[_feedDictionary valueForKey:@"address"]];
- CGSize size = [[_feedDictionary valueForKey:@"address"] sizeWithFont:[UIFont systemFontOfSize:14.0]
- constrainedToSize:CGSizeMake(200.0, 400.0) lineBreakMode:UILineBreakModeWordWrap];
- CGRect frm = cell.detailLabel.frame;
- frm.size.height = size.height;
- [cell.detailLabel setFrame:frm];
- default:
- break;
- }
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- if (indexPath.section == 2) {
- NSString *address = [_feedDictionary valueForKey:@"address"];
- CGSize recommendedSize = [address sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(320, INT_MAX)];
- return 44 + recommendedSize.height;
- }
- else {
- return 44;
- }
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath;
- @interface PartnerCell : UITableViewCell {
- UILabel *user_name,*lbldate,*lbldesc;
- LoadImage *img_trade;
- UIImageView *partnerimage;
- }
- @property (nonatomic, strong) UILabel *user_name,*lbldate,*lbldesc;
- @property (nonatomic, strong) LoadImage *img_trade;
- @property (nonatomic, strong) UIImageView *partnerimage;
- @end
- @implementation PartnerCell
- @synthesize user_name,lbldate,lbldesc;
- @synthesize img_trade,partnerimage;
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- [self setSelectionStyle:UITableViewCellSelectionStyleNone];
- user_name = [[UILabel alloc] initWithFrame:CGRectMake(75,8,200,15)];
- [user_name setBackgroundColor:[UIColor clearColor]];
- user_name.font = [UIFont fontWithName:@"Arial-BoldMT" size:15];
- [user_name setTextColor:[UIColor colorWithRed:70/255.00f green:70/255.00f blue:70/255.00f alpha:1.0]];
- [self addSubview:user_name];
- lbldate = [[UILabel alloc] initWithFrame:CGRectMake(75,28,200,15)];
- [lbldate setBackgroundColor:[UIColor clearColor]];
- lbldate.font = [UIFont fontWithName:@"Arial" size:14];
- [lbldate setTextColor:[UIColor darkGrayColor]];
- [self addSubview:lbldate];
- lbldesc = [[UILabel alloc] initWithFrame:CGRectMake(75,45,170,35)];
- [lbldesc setBackgroundColor:[UIColor clearColor]];
- lbldesc.font = [UIFont fontWithName:@"Arial" size:13];
- lbldesc.numberOfLines = 2;
- [lbldesc setTextColor:[UIColor darkGrayColor]];
- [self addSubview:lbldesc];
- img_trade = [[LoadImage alloc] initWithFrame:CGRectMake(3, 5, 54, 55)];
- img_trade.userInteractionEnabled = YES;
- [self addSubview:img_trade];
- }
- return self;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- NSString *CellIdentifier = [NSString stringWithFormat:@"%@",[[Partarray objectAtIndex:indexPath.row-1] valueForKey:@"part_id"]];
- cell = (PartnerCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- cell=nil;
- if (cell == nil)
- {
- cell = [[PartnerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
- //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[Partarray objectAtIndex:indexPath.row]] autorelease];
- cell.selectionStyle= UITableViewCellSelectionStyleGray;
- cell.backgroundColor = [UIColor clearColor];
- cell.user_name.frame=CGRectMake(75,8,340,15);
- cell.lbldate.frame=CGRectMake(75,28,340,15);
- cell.lbldesc.frame=CGRectMake(75,45,340,35);
- cell.user_name.text = @"user name";
- cell.lbldate.text = @"date";
- cell.lbldesc.text = @"description";
- }
- return cell;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement