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

Homework Done - Diana #28

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
256 changes: 148 additions & 108 deletions OptionSelector.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions OptionSelector/AllCategoriesTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// AllCategoriesTableViewController.h
// OptionSelector
//
// Created by Diana Elezaj on 8/13/15.
// Copyright (c) 2015 Diana Elezaj. All rights reserved.
//

#import <UIKit/UIKit.h>


@interface AllCategoriesTableViewController : UITableViewController

@property (nonatomic)NSArray *CQCategory;

@end
141 changes: 141 additions & 0 deletions OptionSelector/AllCategoriesTableViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
//
// AllCategoriesTableViewController.m
// OptionSelector
//
// Created by Diana Elezaj on 8/13/15.
// Copyright (c) 2015 Diana Elezaj. All rights reserved.
//

#import "AllCategoriesTableViewController.h"
#import "CQCategory.h"
#import "DetailsTableViewController.h"


@interface AllCategoriesTableViewController ()
@property (nonatomic) NSArray *allCategories;

@end

@implementation AllCategoriesTableViewController

- (void)initializeData
{
CQCategory *PhoneRingtone = [[CQCategory alloc] init];
CQCategory *SoundProfile = [[CQCategory alloc] init];
CQCategory *IncomingCallVibration = [[CQCategory alloc] init];
CQCategory *BackgroundColor = [[CQCategory alloc] init];

PhoneRingtone.name = @"Phone Ringtone ♫";
PhoneRingtone.options = @[
@"Phone Ringing",
@"Vintage Phone Ringing",
@"Tongue Rolling",
@"Doorbell",
@"Two Tone Doorbell",
@"Telephone Ring"
];

SoundProfile.name = @"Sound Profile";
SoundProfile.options = @[
@"Sound",
@"Vibrate Only",
@"Silent"
];

IncomingCallVibration.name = @"Incoming Call Vibration";
IncomingCallVibration.options = @[
@"Long Lasting",
@"Rapid",
@"Short repeated",
@"Standartd",
@"Ticktock"
];

BackgroundColor.name = @"Background Color";
BackgroundColor.options = @[
@"Blue",
@"Green",
@"Red",
@"Yellow"
];

self.allCategories = @[PhoneRingtone, SoundProfile, IncomingCallVibration, BackgroundColor];

}

- (void)viewDidLoad {
[super viewDidLoad];
[self initializeData];
self.navigationItem.title = @"🔅Settings🔅";

}

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// set navigation bar's tint color when being shown
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.60 green:0.78 blue:0.95 alpha:1.0];
}

- (void)viewDidAppear:(BOOL)animated {
[self.tableView reloadData];

}



#pragma mark Cells color
- (void)tableView: (UITableView*)tableView
willDisplayCell: (UITableViewCell*)cell
forRowAtIndexPath: (NSIndexPath*)indexPath
{
cell.backgroundColor = indexPath.row % 2
? [UIColor colorWithRed:0.87 green:0.93 blue:0.98 alpha:1.0]
: [UIColor whiteColor];
}






#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return self.allCategories.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CategorySelected" forIndexPath:indexPath];
CQCategory *displayCategory = [self.allCategories objectAtIndex:indexPath.row];

cell.textLabel.text = displayCategory.name;

cell.detailTextLabel.text = displayCategory.selection;

return cell;
}

#pragma mark - Navigation


- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

DetailsTableViewController *vc = segue.destinationViewController;

NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];

CQCategory *newCategory = [self.allCategories objectAtIndex:indexPath.row];
vc.category = newCategory;

vc.delegate = self;
}

@end
4 changes: 2 additions & 2 deletions OptionSelector/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// AppDelegate.h
// OptionSelector
//
// Created by Michael Kavouras on 8/9/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
// Created by Diana Elezaj on 8/13/15.
// Copyright (c) 2015 Diana Elezaj. All rights reserved.
//

#import <UIKit/UIKit.h>
Expand Down
4 changes: 2 additions & 2 deletions OptionSelector/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// AppDelegate.m
// OptionSelector
//
// Created by Michael Kavouras on 8/9/15.
// Copyright (c) 2015 Mike Kavouras. All rights reserved.
// Created by Diana Elezaj on 8/13/15.
// Copyright (c) 2015 Diana Elezaj. All rights reserved.
//

#import "AppDelegate.h"
Expand Down
2 changes: 1 addition & 1 deletion OptionSelector/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<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 Diana Elezaj. 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"/>
Expand Down
99 changes: 84 additions & 15 deletions OptionSelector/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,25 +1,94 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="jYj-9P-BcS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<!--Root View Controller-->
<scene sceneID="N9g-Ik-mB0">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<tableViewController id="DgN-vN-cZ6" customClass="AllCategoriesTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="DUk-Td-wab">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CategorySelected" textLabel="E8H-4R-6ad" detailTextLabel="1z2-pD-5Y1" style="IBUITableViewCellStyleValue1" id="Bf1-oW-JSe">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Bf1-oW-JSe" id="759-YH-Dlb">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="E8H-4R-6ad">
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1z2-pD-5Y1">
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.34642683928753881" green="0.42926369073331527" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="p1g-wz-AlW" kind="show" id="ZI4-zg-D93"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="DgN-vN-cZ6" id="s6c-hS-qon"/>
<outlet property="delegate" destination="DgN-vN-cZ6" id="ZcT-qD-dvF"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Root View Controller" id="Tsa-dd-TvU"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="eVF-Ou-Ne5" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="529" y="198"/>
</scene>
<!--Details Table View Controller-->
<scene sceneID="qEK-kq-2zu">
<objects>
<tableViewController id="p1g-wz-AlW" customClass="DetailsTableViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="NFv-Jv-EE3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="OptionSelected" id="IHh-Jt-Nug">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="IHh-Jt-Nug" id="5yR-lR-II5">
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="p1g-wz-AlW" id="gX2-wb-xMZ"/>
<outlet property="delegate" destination="p1g-wz-AlW" id="Vur-1x-mr0"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1PT-mB-4U7" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1207" y="198"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="qsA-KI-74B">
<objects>
<navigationController id="jYj-9P-BcS" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="rup-FA-oKe">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="DgN-vN-cZ6" kind="relationship" relationship="rootViewController" id="JqY-yc-1A0"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="5YD-uc-vnA" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-291" y="198"/>
</scene>
</scenes>
</document>
Binary file added OptionSelector/ButtonClickOn.mp3
Binary file not shown.
19 changes: 19 additions & 0 deletions OptionSelector/CQCategory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CQCategory.h
// OptionSelector
//
// Created by Diana Elezaj on 8/13/15.
// Copyright (c) 2015 Diana Elezaj. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface CQCategory : NSObject


@property (nonatomic)NSString *name;
@property (nonatomic)NSArray *options;
@property (nonatomic)NSString *selection;


@end
13 changes: 13 additions & 0 deletions OptionSelector/CQCategory.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// CQCategory.m
// OptionSelector
//
// Created by Diana Elezaj on 8/13/15.
// Copyright (c) 2015 Diana Elezaj. All rights reserved.
//

#import "CQCategory.h"

@implementation CQCategory

@end
20 changes: 20 additions & 0 deletions OptionSelector/DetailsTableViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// DetailsTableViewController.h
// OptionSelector
//
// Created by Diana Elezaj on 8/13/15.
// Copyright (c) 2015 Diana Elezaj. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CQCategory.h"

#import "AllCategoriesTableViewController.h"


@interface DetailsTableViewController : UITableViewController

@property (nonatomic) CQCategory *category;
@property (nonatomic,weak) AllCategoriesTableViewController *delegate;

Choose a reason for hiding this comment

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

Good property names


@end
Loading