Reputation: 147
i am using parse.com with a standard user class with extra columns. i.e. address 1,2, and 3
i want to use a view controller that will display the contents from the current user and the address details will be blank until user fills them in then it would save the correct place after a save button press
now i have tried a view controller with textfields and now I'm trying a table view which dosnt look very nice hence view controller . but i can't seem to get any to pull the details in to the text fields. has anyone got any ideas how i can do this
any online tuts or example i can use. i have tried posting this to parse but my post has been up for nearly a week and i posted again 2 days ago and no one seems to answer link to parse post https://parse.com/questions/fill-a-view-controller-with-my-user-details-to-edit-and-add-more-info
thanks in advance
i am using Xcode 5 DP2 and iOS 7.1 SDK
- (void)viewDidLoad
{
[super viewDidLoad];
PFUser *currentUser = [PFUser currentUser];
PFQuery *query = [PFUser query];
[query whereKey:@"username" equalTo:currentUser];
NSArray *userDetails = [query findObjects];
UserNameText.text = objectForKey@"username";
EmailAddressText.text = objectForKey@"email";
}
.h file
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
@interface UserEditViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *UserNameText;
@property (weak, nonatomic) IBOutlet UITextField *EmailAddressText;
@property (weak, nonatomic) IBOutlet UITextField *MobileText;
@property (weak, nonatomic) IBOutlet UITextField *Address1Text;
@property (weak, nonatomic) IBOutlet UITextField *Address2Text;
@property (weak, nonatomic) IBOutlet UITextField *PostCodeText;
@property (weak, nonatomic) IBOutlet UITextField *TaxiOrCust;
- (IBAction)SaveBtn:(id)sender;
- (IBAction)RestePasswordBtn:(id)sender;
@end
Upvotes: 1
Views: 3320
Reputation: 16874
The currentUser
of PFUser
is a Parse Object with all the properties you have set, there's no need to do a query to get it/them.
The main things that are different about the PFUser class are detailed in the guide, specifically you should only create them using the supplied signUp
method.
Any changes you make to the current user, you can simply call the save
method.
Upvotes: 1