Guest User

Untitled

a guest
Jan 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.73 KB | None | 0 0
  1. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  2. {
  3.  
  4.  
  5. if (indexPath.row==0)
  6. {
  7. HeaderCell *cell=[tableView dequeueReusableCellWithIdentifier:@"headercell" forIndexPath:indexPath];
  8. objectForKey:@"profile_pic"] , @"cover_pic":[response objectForKey:@"cover_pic"], @"follow_count":[response objectForKey:@"follow_count"], @"following_count":[response objectForKey:@"following_count"] , @"user_name":[response objectForKey:@"user_name"], @"name":[response objectForKey:@"name"],};
  9.  
  10.  
  11. NSMutableDictionary *data= response;
  12.  
  13. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(GalleryClicked)];
  14. tapGesture.numberOfTapsRequired = 1;
  15. [cell.img_gallery setUserInteractionEnabled:YES];
  16. [cell.img_gallery addGestureRecognizer:tapGesture];
  17.  
  18.  
  19.  
  20. UITapGestureRecognizer *viewProfilepic = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showProfilePic)];
  21. viewProfilepic.numberOfTapsRequired = 1;
  22. [cell.img_profilepic setUserInteractionEnabled:YES];
  23. [cell.img_profilepic addGestureRecognizer:viewProfilepic];
  24.  
  25. UITapGestureRecognizer *viewcoverpic = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showCoverPic)];
  26. viewcoverpic.numberOfTapsRequired = 1;
  27. [cell.img_coverPic setUserInteractionEnabled:YES];
  28. [cell.img_coverPic addGestureRecognizer:viewcoverpic];
  29.  
  30.  
  31.  
  32. [cell.btn_message addTarget:self action:@selector(myMessages) forControlEvents:UIControlEventTouchUpInside];
  33. [cell.btn_notification addTarget:self action:@selector(notifications) forControlEvents:UIControlEventTouchUpInside];
  34.  
  35. [cell setUpHeaderCellWithData:data];
  36.  
  37.  
  38. if ([data objectForKey:@"profile_pic"])
  39. {
  40. if ([[data objectForKey:@"profile_pic"] containsString:@"http"])
  41. profilPicUrl=[data objectForKey:@"profile_pic"];
  42. else
  43. profilPicUrl=@"http://gleamedm.com/reb/img/fans/profile_pic/default.jpg";
  44. }
  45.  
  46.  
  47. if ([data objectForKey:@"cover_pic"])
  48. {
  49. if ([[data objectForKey:@"cover_pic"] containsString:@"http"])
  50. coverPicUrl=[data objectForKey:@"cover_pic"];
  51.  
  52. else
  53. coverPicUrl=[NSString stringWithFormat:@"http://gleamedm.com/reb/img/fans/cover_pic/%@",[data objectForKey:@"cover_pic"]];
  54. }
  55. else
  56. coverPicUrl=@"http://gleamedm.com/reb/img/fans/cover_pic/default.jpg";
  57.  
  58.  
  59.  
  60.  
  61. return cell;
  62. }
  63. else
  64. {
  65. int index=(int)indexPath.row-1; // bcoz 0 is for header
  66. indexPath=[NSIndexPath indexPathForRow:index inSection:0];
  67.  
  68. SinglePost *postObj = (SinglePost *)[posts objectAtIndex:index];
  69.  
  70. if (postObj.msg_postImgStr .length >0)
  71. {
  72. MyProfileDataCell2 *cell=(MyProfileDataCell2*)[tableView dequeueReusableCellWithIdentifier:@"dataCell2" forIndexPath:indexPath];
  73.  
  74. [cell setupCellWithPostObject:postObj];
  75. [cell.textView setDelegate: self];
  76. cell.textView.tag=index;
  77.  
  78.  
  79. UITapGestureRecognizer *tapGesture2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(Postclicked:)];
  80. [cell.topView setUserInteractionEnabled:YES];
  81. [cell.topView addGestureRecognizer:tapGesture2];
  82. [cell.topView setTag:index];
  83.  
  84.  
  85. [cell.btn_comment addTarget:self action:@selector(commentClicked:) forControlEvents:UIControlEventTouchUpInside];
  86. [cell.btn_likeUnlike addTarget:self action:@selector(likeUnlikeClicked:) forControlEvents:UIControlEventTouchUpInside];
  87.  
  88. cell.btn_likeUnlike.tag=cell.btn_comment.tag=index;
  89.  
  90. UITapGestureRecognizer *viewcoverpic = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(PostPictureClicked:)];
  91. viewcoverpic.numberOfTapsRequired = 1;
  92. [cell.img_messagePic setUserInteractionEnabled:YES];
  93. [cell.img_messagePic addGestureRecognizer:viewcoverpic];
  94. [cell.img_messagePic setTag:index];
  95.  
  96.  
  97. return cell;
  98. }
  99. else
  100. {
  101. DataCell1 *cell=[tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
  102. [cell setupCellWithPostObject:postObj];
  103.  
  104. [cell.textView setDelegate: self];
  105. cell.textView.tag=index;
  106.  
  107. UITapGestureRecognizer *tapGesture2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(Postclicked:)];
  108. [cell.topView setUserInteractionEnabled:YES];
  109. [cell.topView addGestureRecognizer:tapGesture2];
  110. [cell.topView setTag:index];
  111.  
  112.  
  113. [cell.btn_comment addTarget:self action:@selector(commentClicked:) forControlEvents:UIControlEventTouchUpInside];
  114. [cell.btn_likeUnlike addTarget:self action:@selector(likeUnlikeClicked:) forControlEvents:UIControlEventTouchUpInside];
  115.  
  116. cell.btn_likeUnlike.tag=cell.btn_comment.tag=index;
  117. return cell;
  118. }
  119. }
Add Comment
Please, Sign In to add comment