Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KPicart-HW4 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
459 changes: 459 additions & 0 deletions NavViewsAndOptionSelector.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// AppDelegate.h
// OptionSelector
// NavViewsAndOptionSelector
//
// Created by Michael Kavouras on 8/9/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
// Created by MacMan on 8/12/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// AppDelegate.m
// OptionSelector
// NavViewsAndOptionSelector
//
// Created by Michael Kavouras on 8/9/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
// Created by MacMan on 8/12/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import "AppDelegate.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 Mike Kavouras. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 MacManApp. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="OptionSelector" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="NavViewsAndOptionSelector" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
Expand Down
234 changes: 234 additions & 0 deletions NavViewsAndOptionSelector/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions NavViewsAndOptionSelector/HWResources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
HW#4 Week4 Navigation Views/ Storyboards /OptionSelector Resources https://developer.apple.com/library/ios/recipes/xcode_help-IB_storyboard/chapters/StoryboardSegue.html


https://developer.apple.com/library/ios/recipes/xcode_help-IB_storyboard/chapters/AboutStoryboards.html

https://www.youtube.com/watch?v=2p8Gctq62oU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.mikekavouras.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>com.buleApp.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down Expand Up @@ -36,5 +36,12 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
25 changes: 25 additions & 0 deletions NavViewsAndOptionSelector/KPAddItemTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// KPAddItemTableViewController.h
// NavViewsAndOptionSelector
//
// Created by MacMan on 8/14/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>

@class KPIndexListTableViewController;


@interface KPAddItemTableViewController : UITableViewController

-(IBAction)cancelButtonPressed:(id)sender;
-(IBAction)doneButtonPressed:(id)sender;

@property (nonatomic, strong)IBOutlet UITextField *nameField;

@property (nonatomic, strong)KPIndexListTableViewController *indexListTableViewController;



@end
60 changes: 60 additions & 0 deletions NavViewsAndOptionSelector/KPAddItemTableViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// KPAddItemTableViewController.m
// NavViewsAndOptionSelector
//
// Created by MacMan on 8/14/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import "KPAddItemTableViewController.h"
#import "KPIndexListTableViewController.h"
#import "KPIndex.h"


@interface KPAddItemTableViewController ()

@end

@implementation KPAddItemTableViewController

@synthesize nameField = _nameField;
@synthesize indexListTableViewController = _indexListTableViewController;


- (void)viewDidLoad {
[super viewDidLoad];

// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - IBActions

-(void)cancelButtonPressed:(id)sender{

[self dismissViewControllerAnimated:YES completion:nil];

}

-(void) doneButtonPressed:(id)sender{
KPIndex *newItem = [[KPIndex alloc] initWithName:self.nameField.text done:NO];


[self.indexListTableViewController.indexArray addObject:newItem];



[self dismissViewControllerAnimated:YES completion:nil];

}


@end
25 changes: 25 additions & 0 deletions NavViewsAndOptionSelector/KPEditItemTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// KPEditItemTableViewController.h
// NavViewsAndOptionSelector
//
// Created by MacMan on 8/14/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>

@class KPIndex;

@interface KPEditItemTableViewController : UITableViewController


@property (nonatomic, strong) IBOutlet UITextField *nameField;
@property (nonatomic, strong) IBOutlet UISwitch *doneSwitch;

@property (nonatomic, strong) KPIndex *item;



-(IBAction)itemDataChanged:(id)sender;

@end
59 changes: 59 additions & 0 deletions NavViewsAndOptionSelector/KPEditItemTableViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// KPEditItemTableViewController.m
// NavViewsAndOptionSelector
//
// Created by MacMan on 8/14/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import "KPEditItemTableViewController.h"
#import "KPIndex.h"

@interface KPEditItemTableViewController ()

@end

@implementation KPEditItemTableViewController

@synthesize nameField = _nameField;
@synthesize doneSwitch = _doneSwitch;
@synthesize item = _item;





- (void)viewDidLoad {
[super viewDidLoad];

// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;


self.nameField.text = self.item.name;
[self.doneSwitch setOn: self.item.done];



}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark -IBActions

-(void)itemDataChanged:(id)sender {

self.item.name = self.nameField.text;
self.item.done = self.doneSwitch.isOn;


}


@end
22 changes: 22 additions & 0 deletions NavViewsAndOptionSelector/KPIndex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// KPIndex.h
// NavViewsAndOptionSelector
//
// Created by MacMan on 8/14/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface KPIndex : UIViewController

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does KPIndex inherit from UIViewController? It doesn't seem to act as a view controller, but rather as a simple object with a couple of properties. I'd suggest making it inherit from NSObject instead.

Also, I'm a bit confused by the naming choice. An index is most frequently used to refer to an integer denoting the position of an element in a sequence or other data structure, not the element itself. If you want a generic name for an element in a list, something like ListItem or Element would be more descriptive.



@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign)BOOL done;

-(id)initWithName:(NSString *)name done:(BOOL)done;




@end
64 changes: 64 additions & 0 deletions NavViewsAndOptionSelector/KPIndex.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// KPIndex.m
// NavViewsAndOptionSelector
//
// Created by MacMan on 8/14/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import "KPIndex.h"

@interface KPIndex ()

@end


@implementation KPIndex
@synthesize name = _name;
@synthesize done = _done;


-(id)initWithName:(NSString *)name done:(BOOL)done {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the custom initializer method. :D

self = [super init];

if (self){
self.name = name;
self.done = done;


}

return self;

}



@end




//@implementation KPIndex
//
//- (void)viewDidLoad {
// [super viewDidLoad];
// // Do any additional setup after loading the view.
//}
//
//- (void)didReceiveMemoryWarning {
// [super didReceiveMemoryWarning];
// // Dispose of any resources that can be recreated.
//}
//
///*
//#pragma mark - Navigation
//
//// In a storyboard-based application, you will often want to do a little preparation before navigation
//- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// // Get the new view controller using [segue destinationViewController].
// // Pass the selected object to the new view controller.
//}
//*/
//
//@end
16 changes: 16 additions & 0 deletions NavViewsAndOptionSelector/KPIndexListTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// KPIndexListTableViewController.h
// NavViewsAndOptionSelector
//
// Created by MacMan on 8/14/15.
// Copyright (c) 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface KPIndexListTableViewController : UITableViewController

@property (nonatomic,strong) NSMutableArray *indexArray;


@end
Loading