Skip to content

Commit

Permalink
fixed errors and did clean codes
Browse files Browse the repository at this point in the history
  • Loading branch information
nnuch authored and nnuch committed Apr 7, 2018
1 parent 3851254 commit b3b4c14
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 19 deletions.
11 changes: 6 additions & 5 deletions iOS-Assignment-3/AboutPageView/PageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//helper method

//MARK: Helper method
- (UIViewController *) viewControllerAtIndex: (NSUInteger)index{
//creating instance
ViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
Expand All @@ -57,6 +58,7 @@ - (UIViewController *)pageViewController:(UIPageViewController *)pageViewControl
return [self viewControllerAtIndex:index];
}


- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:( UIViewController *)viewController {
NSUInteger index = ((ViewController *) viewController).pageIndex;
if (index == NSNotFound) {
Expand All @@ -72,28 +74,27 @@ - (UIViewController *)pageViewController:(UIPageViewController *)pageViewControl
}


// fixed problem, button didn't appear on the screen.
// fixed issue, button didn't appear on the screen.
// indicator button get called by using presentationCountForPageViewController methods
- (void) setupPageControl
{
[[UIPageControl appearance] setPageIndicatorTintColor: [UIColor lightGrayColor]];
[[UIPageControl appearance] setCurrentPageIndicatorTintColor: [UIColor greenColor]];
[[UIPageControl appearance] setTintColor: [UIColor greenColor]];
[[UIPageControl appearance] setBackgroundColor: [UIColor whiteColor]];


}


- (NSInteger) presentationCountForPageViewController: (UIPageViewController *) pageViewController
{
[self setupPageControl];
return [about count];
}


- (NSInteger) presentationIndexForPageViewController: (UIPageViewController *) pageViewController
{
return 0;
}


@end
4 changes: 2 additions & 2 deletions iOS-Assignment-3/AboutPageView/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

@property (weak, nonatomic) IBOutlet UIImageView *aboutImages;

@property NSString *strImage;
@property NSUInteger *pageIndex;
@property NSString *strImage;
@property NSUInteger *pageIndex;
@property NSUInteger *index;
@end

2 changes: 0 additions & 2 deletions iOS-Assignment-3/AboutPageView/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ @interface ViewController ()

@end


@implementation ViewController
@synthesize strImage, pageIndex;


- (void)viewDidLoad {
[super viewDidLoad];


self.aboutImages.image = [UIImage imageNamed:strImage];

}
Expand Down
6 changes: 4 additions & 2 deletions iOS-Assignment-3/Add/AddViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ @implementation AddViewController
@synthesize buttonOn, buttonOff;



UIImage *originalImage, *editedImage, *imageToUse;

- (void)viewDidLoad {
Expand Down Expand Up @@ -102,11 +103,13 @@ - (void) imagePickerController: (UIImagePickerController *) picker didFinishPick

}


//MARK: ADD
- (IBAction)addImage:(id)sender {
[self startMediaBrowserFromViewController: self usingDelegate: self];
}


//MARK: UPLOAD
- (IBAction)post:(id)sender {

if ((_myImageView.image != nil) && (_myTextField.text != nil)) {
Expand Down Expand Up @@ -144,7 +147,6 @@ - (IBAction)post:(id)sender {
}



//Keyboard show and hide
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
NSLog(@"touchesBegan:withEvent:");
Expand Down
4 changes: 2 additions & 2 deletions iOS-Assignment-3/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
//MARK: Connect my app to my service hosted online (Parse SDK).
[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration){

configuration.applicationId = @"RFLllZKDB8bRDhbk0GoaPpqwfUoaKQlFpJERQzwH";
configuration.applicationId = @"your appID";

configuration.clientKey = @"mAHA1Ur7LUZpdZK11kIj10R76MCEE4dh6csP1g6A";
configuration.clientKey = @"your clientKey";

configuration.server = @"https://parseapi.back4app.com";

Expand Down
1 change: 1 addition & 0 deletions iOS-Assignment-3/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
<connections>
<outlet property="buttonAdd" destination="wiW-ny-bIC" id="n5n-ty-Mvn"/>
<outlet property="buttonOff" destination="wiW-ny-bIC" id="2zG-lk-9VN"/>
<outlet property="buttonOn" destination="wiW-ny-bIC" id="0l2-dr-MBl"/>
<outlet property="myImageView" destination="00i-BP-koD" id="JUY-l6-HSe"/>
<outlet property="myTextField" destination="Ngs-KF-UKS" id="xca-gq-nEw"/>
</connections>
Expand Down
2 changes: 1 addition & 1 deletion iOS-Assignment-3/CollectionView/ParseViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@property (weak, nonatomic) IBOutlet UIView *detailView;
@property (weak, nonatomic) IBOutlet UIImageView *detailImage;

- (IBAction)dismissBtn:(id)sender;
//- (IBAction)dismissBtn:(id)sender;

@end

Expand Down
5 changes: 2 additions & 3 deletions iOS-Assignment-3/CollectionView/ParseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ @implementation ParseViewController
- (void)viewDidLoad {
[super viewDidLoad];


[self queryParseMethod];


//self.imagesCollection.backgroundColor = [UIColor grayColor];
self.navigationController.navigationBar.prefersLargeTitles = YES;
Expand Down Expand Up @@ -51,7 +50,7 @@ - (void) queryParseMethod {

PFQuery *query = [PFQuery queryWithClassName:@"MyPost"];

//and it will return object found within that class
//it will return object found within that class
//and assign to imageFileArray

[query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
Expand Down
4 changes: 2 additions & 2 deletions iOS-Assignment-3/TableView/TableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ -(void)viewWillAppear:(BOOL)animated {
- (void) retrieveFromParse {
PFQuery *query = [PFQuery queryWithClassName:@"MyPost"];

//and it will return object found within that class
//it will return object found within that class
//and assign to Array
[query findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
if (!error){
Expand All @@ -59,7 +59,7 @@ - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[self.tableView setEditing:editing animated:YES];

//Do not let the user add if the app is in edit mode.
//Do not let the user do anything if the app is in edit mode.
if(editing)
self.navigationItem.rightBarButtonItem.enabled = YES;
else
Expand Down

0 comments on commit b3b4c14

Please sign in to comment.