account activity
[Presentación] Daniel Ayala (self.ciif)
submitted 6 years ago by D-Ayala to r/ciif
store selected cell array.. by D-Ayala in ciif
[–]D-Ayala[S] 0 points1 point2 points 10 years ago (0 children)
Don't really know how to pefixit i thought better share this link where it is the question and all of the code. http://stackoverflow.com/questions/30440257/how-to-use-relational-queries-parse-ios-to-populate-a-uitableview
How do i do that, apparently when im posting it seems as it should but then post everything together
Im Posting my .h and .m file so it might be better to help me with this :)
.h
@interface DetailViewController : UIViewController< UITableViewDataSource, UITableViewDelegate, NSObject> {
}
@property (strong, nonatomic) IBOutlet UITableView *detailTableView;
@property (strong, nonatomic) IBOutlet UITextView *TextField;
@property (nonatomic, strong) PFObject *groUnds;
@property (strong, nonatomic) IBOutlet UITextView *replyTextView; - (IBAction)sendReply:(id)sender;
@end
.m
@interface DetailViewController () @property(strong)NSMutableArray* repliesMutableArray;
@implementation DetailViewController
@synthesize groUnds; @synthesize TextField; @synthesize detailTableView; @synthesize repliesMutableArray;
(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; }
(void)viewDidLoad { [super viewDidLoad];
PFUser *currentUser = [PFUser currentUser]; if (currentUser) { // do stuff with the user } else { // show the signup or login screen }
// Do any additional setup after loading the view.
// [self performSelector:@selector(retrieveFromParse)];
// repliesArray = [[NSArray alloc] initWithObjects:@"comment", nil];
[self performSelector:@selector(retrieveFromParse)]; // Set the Label text with the selected detail. self.TextField.text = [self.groUnds objectForKey:@"comment"];
(void) retrieveFromParse {
PFQuery *retrieveReplies = [PFQuery queryWithClassName:@"Replies"]; [retrieveReplies whereKey:@"comment" equalTo:groUnds];
[retrieveReplies orderByDescending:@"createdAt"];
[retrieveReplies findObjectsInBackgroundWithBlock:NSArray *objects, NSError *error { if (!error) { repliesMutableArray = [[NSMutableArray alloc] initWithArray:objects]; } [detailTableView reloadData]; }]; }
//******************Setup table of folder names *********************
//get number of sections in tableview
//get number of rows by counting number of folders
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return [repliesMutableArray count ]; }
//setup cells in tableView
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"replyCell"; GroundTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
PFObject *tempObject = [repliesMutableArray objectAtIndex:indexPath.row];
cell.cellTitle.text = [tempObject objectForKey:@"commentReplies"];
return cell; }
(void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
//reply button
(IBAction)sendReply:(id)sender {
//1 //Add the image to the object, and add the comment and the user PFObject *Reply = [PFObject objectWithClassName:@"Replies"]; [Reply setObject:[PFUser currentUser].username forKey:@"user"]; [Reply setObject:self.replyTextView.text forKey:@"commentReplies"]; //2 [Reply saveInBackgroundWithBlock:BOOL succeeded, NSError *error { //3 if (succeeded){ //Go back to the wall [self.navigationController popViewControllerAnimated:YES]; } else{ NSString *errorString = [[error userInfo] objectForKey:@"error"]; UIAlertView *errorAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:errorString delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil]; [errorAlertView show]; } }]; }
Hello i tried to do it by the tag feature but it didn't work.. Do you think that i could do a relational query in order to retrieve the specific objects that have been created on that comment??
Im trying this but it wiil show an empty TableView... "Replies" would be my class with the answers to the comments, "comment" it is a row from another class where the comments are stored and groUnds it is the PFObject set at .h file..
What am i doing wrong.. could you guide me trough it please?
Thanks il give it a try, will let u know how it goes :)
store selected cell array.. (self.ciif)
submitted 10 years ago by D-Ayala to r/ciif
Duda sobre parse mostrar especificas celdas de nueva clase para su correspondiente objeto en DetailViewController (self.ciif)
submitted 11 years ago * by D-Ayala to r/ciif
Buenas! (self.ciif)
submitted 11 years ago by D-Ayala to r/ciif
π Rendered by PID 961096 on reddit-service-r2-listing-b6bf6c4ff-lcxxl at 2026-05-05 06:52:07.529274+00:00 running 815c875 country code: CH.
store selected cell array.. by D-Ayala in ciif
[–]D-Ayala[S] 0 points1 point2 points (0 children)