Permalink
Browse files

updated properties

  • Loading branch information...
1 parent d735b01 commit 3c0da7c6ba6f2eecb36c921df664e0882aa2183e @rodsimpson rodsimpson committed Jan 7, 2013
@@ -12,9 +12,8 @@
@interface FollowUserViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *usernameField;
-@property (nonatomic, strong) Client * clientObj;
+@property (nonatomic, strong) Client * client;
--(void)setClient:(Client *)inclient;
- (IBAction)followButton:(id)sender;
@end
@@ -16,12 +16,16 @@ @interface FollowUserViewController ()
@implementation FollowUserViewController
@synthesize usernameField;
-@synthesize clientObj;
+@synthesize client = _client;
UIViewController *sender;
--(void)setClient:(Client *)inclient{
- clientObj = inclient;
+- (void)setClient:(Client *)c {
+ _client = c;
+}
+
+- (Client *)client {
+ return _client;
}
@@ -59,7 +63,7 @@ -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
[usernameField resignFirstResponder];
if ([segue.identifier isEqualToString:@"returnToFollowing"]){
TabBarController *dvc = [segue destinationViewController];
- [dvc setClient:clientObj];
+ [dvc setClient:_client];
[dvc setNextViewToFollowing];
}
@@ -71,7 +75,7 @@ - (IBAction)followButton:(id)sender {
NSString * errorMesssage;
if (![[usernameField text] isEqualToString:@""]) {
- if ([clientObj followUser:[usernameField text]]) {
+ if ([_client followUser:[usernameField text]]) {
//invoke segue back to message list
return [self performSegueWithIdentifier:@"returnToFollowing" sender:self];
} else {
@@ -11,8 +11,6 @@
@interface FollowingViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
-@property (nonatomic, strong) Client *clientObj;
-
--(void)setClient:(Client *)inclient;
+@property (nonatomic, strong) Client *client;
@end
@@ -26,14 +26,19 @@ - (UIImage*)imageScaledToSize:(CGSize)size {
@implementation FollowingViewController
-@synthesize clientObj;
+@synthesize client = _client;
-NSArray *following;
+- (void)setClient:(Client *)c {
+ _client = c;
+}
--(void)setClient:(Client *)inclient{
- clientObj = inclient;
+- (Client *)client {
+ return _client;
}
+NSArray *following;
+
+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
@@ -47,7 +52,7 @@ - (void)viewDidLoad
{
[super viewDidLoad];
- following = [clientObj getFollowing];
+ following = [_client getFollowing];
((UITabBarController *) self.parentViewController).tabBar.hidden
= NO;
@@ -57,7 +62,7 @@ -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"followUserSegue"]){
FollowUserViewController *dvc = [segue destinationViewController];
- [dvc setClient:clientObj];
+ [dvc setClient:_client];
}
}
@@ -13,7 +13,7 @@
@property (weak, nonatomic) IBOutlet UITextField *usernameField;
@property (weak, nonatomic) IBOutlet UITextField *passwordField;
-@property (nonatomic, strong) Client *clientObj;
+@property (nonatomic, strong) Client *client;
- (IBAction)registerButton:(id)sender;
- (IBAction)loginButton:(id)sender;
@@ -17,26 +17,35 @@ @interface LoginViewController ()
@implementation LoginViewController
-@synthesize clientObj;
+@synthesize client = _client;
+
+
+- (void)setClient:(Client *)c {
+ _client = c;
+}
+
+- (Client *)client {
+ return _client;
+}
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"loginSeque"]){
TabBarController *dvc = [segue destinationViewController];
- [dvc setClient:clientObj];
+ [dvc setClient:_client];
}
if ([segue.identifier isEqualToString:@"registerSeque"]){
RegisterViewController *dvc = [segue destinationViewController];
- [dvc setClient:clientObj];
+ [dvc setClient:_client];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
- clientObj = [[Client alloc] init];
+ _client = [[Client alloc] init];
}
- (void)didReceiveMemoryWarning
@@ -46,7 +55,7 @@ - (void)didReceiveMemoryWarning
}
- (IBAction)registerButton:(id)sender {
- [self performSegueWithIdentifier:@"registerSeque" sender:clientObj];
+ [self performSegueWithIdentifier:@"registerSeque" sender:_client];
}
@@ -61,7 +70,7 @@ - (IBAction)loginButton:(id)sender {
NSString *username = [_usernameField text];
NSString *password = [_passwordField text];
- if ([clientObj login:username withPassword:password]){
+ if ([_client login:username withPassword:password]){
[self performSegueWithIdentifier:@"loginSeque" sender:self];
} else {
//pop an alert saying the login failed
@@ -11,8 +11,6 @@
@interface MessageViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
-@property (nonatomic, strong) Client *clientObj;
-
--(void)setClient:(Client *)inclient;
+@property (nonatomic, strong) Client *client;
@end
@@ -32,15 +32,18 @@ @interface MessageViewController ()
@implementation MessageViewController
-
-@synthesize clientObj;
NSArray *messages;
+@synthesize client = _client;
+
--(void)setClient:(Client *)inclient{
- clientObj = inclient;
+- (void)setClient:(Client *)c {
+ _client = c;
}
+- (Client *)client {
+ return _client;
+}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -55,7 +58,7 @@ - (void)viewDidLoad
{
[super viewDidLoad];
- messages = [clientObj getMessages];
+ messages = [_client getMessages];
}
@@ -69,7 +72,7 @@ -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"newMessageSegue"]){
NewMessageViewController *dvc = [segue destinationViewController];
- [dvc setClient:clientObj];
+ [dvc setClient:_client];
}
}
@@ -12,9 +12,8 @@
@interface NewMessageViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITextView *messageTextField;
-@property (nonatomic, strong) Client *clientObj;
+@property (nonatomic, strong) Client *client;
--(void)setClient:(Client *)inclient;
- (IBAction)postMessage:(id)sender;
@end
@@ -17,12 +17,15 @@ @implementation NewMessageViewController
@synthesize messageTextField;
-@synthesize clientObj;
+@synthesize client = _client;
--(void)setClient:(Client *)inclient{
- clientObj = inclient;
+- (void)setClient:(Client *)c {
+ _client = c;
}
+- (Client *)client {
+ return _client;
+}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -63,7 +66,7 @@ -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
[messageTextField resignFirstResponder];
if ([segue.identifier isEqualToString:@"messagePostedSegue"]){
TabBarController *dvc = [segue destinationViewController];
- [dvc setClient:clientObj];
+ [dvc setClient:_client];
}
}
@@ -74,7 +77,7 @@ - (IBAction)postMessage:(id)sender {
NSString * errorMesssage;
if (![[messageTextField text] isEqualToString:@""]) {
- if ([clientObj postMessage:[messageTextField text]]) {
+ if ([_client postMessage:[messageTextField text]]) {
//invoke segue back to message list
return [self performSegueWithIdentifier:@"messagePostedSegue" sender:self];
} else {
@@ -9,21 +9,18 @@
#import <UIKit/UIKit.h>
#import "Client.h"
-@interface RegisterViewController : UIViewController <UITextFieldDelegate>{
- UITextField *currentTextField;
- BOOL keyboardIsShown;
-}
+@interface RegisterViewController : UIViewController <UITextFieldDelegate>
-@property (nonatomic, strong) Client *clientObj;
+@property (nonatomic, strong) Client *client;
+@property (nonatomic, strong) UITextField *currentTextField;
+@property BOOL keyboardIsShown;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UITextField *usernameField;
@property (weak, nonatomic) IBOutlet UITextField *nameField;
@property (weak, nonatomic) IBOutlet UITextField *emailField;
@property (weak, nonatomic) IBOutlet UITextField *passwordField;
@property (weak, nonatomic) IBOutlet UITextField *rePasswordField;
-
- (IBAction)registerButton:(id)sender;
-- (void)setClient:(Client *)inclient;
@end
@@ -15,14 +15,23 @@ @interface RegisterViewController ()
@implementation RegisterViewController
+@synthesize currentTextField;
+@synthesize keyboardIsShown;
@synthesize scrollView;
@synthesize usernameField;
@synthesize nameField;
@synthesize emailField;
@synthesize passwordField;
@synthesize rePasswordField;
-@synthesize clientObj;
+@synthesize client = _client;
+- (void)setClient:(Client *)c {
+ _client = c;
+}
+
+- (Client *)client {
+ return _client;
+}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -45,10 +54,6 @@ - (void)didReceiveMemoryWarning
// Dispose of any resources that can be recreated.
}
--(void)setClient:(Client *)inclient{
- clientObj = inclient;
-}
-
- (void)viewWillAppear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:self.view.window];
@@ -103,7 +108,7 @@ -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"regsiterSuccessSeque"]){
TabBarController *dvc = [segue destinationViewController];
- [dvc setClient:clientObj];
+ [dvc setClient:_client];
}
}
@@ -121,11 +126,11 @@ - (IBAction)registerButton:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Password error." message:@"The passwords do not match?" delegate:self cancelButtonTitle:@"Try Again" otherButtonTitles:nil];
[alert show];
} else {
- if ([clientObj createUser:username
+ if ([_client createUser:username
withName:name
withEmail:email
withPassword:password]){
- [self performSegueWithIdentifier:@"regsiterSuccessSeque" sender:clientObj];
+ [self performSegueWithIdentifier:@"regsiterSuccessSeque" sender:_client];
} else {
//pop an alert saying the login failed
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Account not created?" message:@"Did you type your username and password correctly?" delegate:self cancelButtonTitle:@"Try Again" otherButtonTitles:nil];
@@ -12,9 +12,8 @@
@interface TabBarController : UITabBarController
@property (nonatomic, strong) NSString *selectedView;
-@property (nonatomic, strong) Client *clientObj;
+@property (nonatomic, strong) Client *client;
-- (void)setClient:(Client *)inclient;
- (void)setNextViewToFollowing;
@end
@@ -16,7 +16,17 @@ @interface TabBarController ()
@implementation TabBarController
@synthesize selectedView;
-@synthesize clientObj;
+@synthesize client = _client;
+
+- (void)setClient:(Client *)c {
+ _client = c;
+ [[[self viewControllers] objectAtIndex:0] setClient: _client];
+ [[[self viewControllers] objectAtIndex:1] setClient: _client];
+}
+
+- (Client *)client {
+ return _client;
+}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -43,14 +53,6 @@ - (void)didReceiveMemoryWarning
// Dispose of any resources that can be recreated.
}
-- (void)setClient:(Client *)inclient {
-
- clientObj = inclient;
-
- [[[self viewControllers] objectAtIndex:0] setClient: clientObj];
- [[[self viewControllers] objectAtIndex:1] setClient: clientObj];
-
-}
- (void)setNextViewToFollowing {
selectedView = @"FOLLOWING";

0 comments on commit 3c0da7c

Please sign in to comment.