Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- [super tableView:tableView didSelectRowAtIndexPath:indexPath];
- rowNo = indexPath.row;
- PFUser *currentUser = [PFUser currentUser];
- PFQuery *query = [PFQuery queryWithClassName:@"Photo"];
- [query whereKey:@"username" equalTo:currentUser.username];
- [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
- _photo = [objects objectAtIndex:rowNo];
- }];
- [self performSegueWithIdentifier:@"showImageCloseup" sender:self];
- }
- -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
- ImageCloseupViewController *destination = [segue destinationViewController];
- destination.photoObject = _photo;
- }
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- PFFile *p = [_photoObject objectForKey:@"photo"];
- [p getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
- if(!error){
- UIImage *image = [UIImage imageWithData:data];
- [_imageView setImage:image];
- }
- }];
- [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
- _photo = [objects objectAtIndex:rowNo];
- }];
- [self performSegueWithIdentifier:@"showImageCloseup" sender:self];
- [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
- _photo = [objects objectAtIndex:rowNo];
- [self performSegueWithIdentifier:@"showImageCloseup" sender:self];
- }];
- // Runs 1st - executes in background thread stores block, then runs block once it's done
- [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
- // Runs 3rd - already segued at this point
- _photo = [objects objectAtIndex:rowNo];
- }];
- // Runs 2nd - starts segue
- [self performSegueWithIdentifier:@"showImageCloseup" sender:self];
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- [super tableView:tableView didSelectRowAtIndexPath:indexPath];
- rowNo = indexPath.row;
- _photo = yourDataArray[indexPath.row];
- [self performSegueWithIdentifier:@"showImageCloseup" sender:self];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement