Phone. Making a phone call within app ( and returning to app after call ends ) is as easy as :

Size: px
Start display at page:

Download "Phone. Making a phone call within app ( and returning to app after call ends ) is as easy as :"

Transcription

1 Phone Making a phone call within app ( and returning to app after call ends ) is as easy as : -(void)makecall { UIApplication *application = [UIApplication sharedapplication]; NSURL *URL = [NSURL URLWithString: [NSString [application openurl:url options:@{} completionhandler:^(bool success) { if (success) { // NSLog(@ Opened url"); } }]; }

2 Mail In order to send a mail from within the app, we need to implement mail protocol : #import <UIKit/UIKit.h> #import "Reachability.h" #import <MessageUI/MessageUI.h> #import ContactsTableViewController : UITableViewController Reachability BOOL

3 Mail In ContactsTableViewController, we ll use asynchronous version of Reachability to check the network status : switch (status) { case NotReachable: _networkisreachable = NO; break; case ReachableViaWWAN: _networkisreachable = YES; break; } case ReachableViaWiFi: _networkisreachable = YES; break;

4 Mail tableview:didselectrowatindexpath: method, case 1 (mail) calls [self showpicker] method. This method displays an composition interface if MFMailComposeViewController exists and the device can send s.

5 Mail If the device can send s and we have internet connection MailApp is launched. For details, see source code Contacts 2

6

7 MapKit Framework The Map Kit framework provides an interface for embedding maps directly into your own windows and views. This framework also provides support for annotating the map, adding overlays etc

8 Maps Drag and drop another ViewController into Main.storyboard Control-connect ContactsTableViewController to the newly added ViewController and set segue s identifier to showmapsegue

9 Maps From objects library select MapKit View, drag and drop into newly add ViewController. Set MapKit View constraints to (0, 0, 0, 0). Your Main.storyboard should resemble :

10 Maps

11 Maps Since MKMapKit requires network connection, in ContactsViewController, case 2 ( maps ) we have : if(!_networkisreachable) { UIAlertController *alert = [UIAlertController alertcontrollerwithtitle:@"error" message:@"device has no Internet access." preferredstyle:uialertcontrollerstylealert]; UIAlertAction* cancelbutton = [UIAlertAction actionwithtitle:@"ok" style:uialertactionstyledefault handler:^(uialertaction *action) { }];

12 Maps [alert addaction:cancelbutton]; [self presentviewcontroller:alert animated:yes completion:nil]; } else { [self performseguewithidentifier:@"showmapsegue" sender:self]; } break;

13 Maps Create new file MapViewController, subclass of UIViewController In Identity Inspector associate newly add UIViewController with MapViewController Using Assistant editor, create IBOutlet MKMapView *mapview MKMapView requires #import <MapKit/MapKit.h>

14 Maps MKMapView requires #import <MapKit/MapKit.h> Here is the interface : #import <UIKit/UIKit.h> #import MapViewController : (weak, nonatomic) IBOutlet MKMapView

15 Maps In MapViewController.m, viewdidload method, we specify location s latitude and longitude as well as coordinate region : CLLocationCoordinate2D location; location.latitude = ; location.longitude= ; MKCoordinateRegion viewregion = MKCoordinateRegionMakeWithDistance(location, 800, 800); [_mapview setregion:viewregion animated:yes];

16 Maps Run

17 Maps Annotation can be easily added if needed : MKPointAnnotation *annotationpoint = [[MKPointAnnotation alloc] init]; annotationpoint.coordinate = location; annotationpoint.title Technology Centre"; annotationpoint.subtitle Road, St. John\'s NL, A1C 6L8"; [_mapview addannotation:annotationpoint];

18 Maps Run

19 WebKit view WebKit view class can be used to embed web content in your application. To do so, you simply create a WebKit view object, attach it to a window, and send it a request to load web content.

20 WebKit view Back in Main.storyboard, add another view controller, control-connect it from ContactsTableViewController and give segue identifier showwebsegue From objects library drag WebKit view (constraints: 0, 0, 0, 0) into a newly added controller. Your Main.storyboard should resemble :

21

22 WebKit view Create new file WebViewController, subclass of UIViewController and in Identity inspector associate it with the newly added view. Using assistant editor create an IBOutlet : #import <UIKit/UIKit.h> #import WebViewController : (weak, nonatomic) IBOutlet WKWebView

23 WebKit view In WebViewController.m, viewdidload method we have : NSURL *url = [NSURL URLWithString:@" NSURLRequest *urlrequest = [NSURLRequest requestwithurl:url]; [_webview loadrequest:urlrequest]; As before, in ContactsTableViewController, we perform segue conditionally:

24 WebKit view Run.

25 WebKit view Class containing WKWebView can implement WKNavigationDelegate. It is recommended that, whenever accessing network, indicator should appear in the header. So, in ContactsViewController we start the network activity indicator before the page is loaded : [[UIApplication sharedapplication] setnetworkactivityindicatorvisible: YES];

26 WebKit view In WebViewController.h we specify that class will implement delegate WebViewController : UIViewController <WKNavigationDelegate> Implementation, viewdidload, specifies webview as its own delegate : [_webview setnavigationdelegate:self];

27 WebKit view And implements method : - (void)webview:(wkwebview *)webview didfinishnavigation:(wknavigation *)navigation { [[UIApplication sharedapplication] setnetworkactivityindicatorvisible: NO]; }

28 WebKit view Starting with ios 9, App Transport Security blocks insecure cleartext HTTP. Temporary exceptions can be configured via Info.plist file. For ios 9 and higher, open Info.plist as source and at the end of the file (before </dict> and </ plist> add:

29 WebKit view <key>nsapptransportsecurity</key> <dict> <key>nsallowsarbitraryloads</key> <true/> <key>nsexceptiondomains</key> <dict/>

30 UICollectionView The Collection View and Flow Layout provide a new, flexible way to present content to the user. The UICollectionView class is responsible for managing the data items that are to be displayed to the user.

31 UICollectionView The collection view instance needs a data source object from which to obtain the data items to be displayed, together with a delegate object to handle user interaction with the collection. These objects must implement the UICollectionViewDataSource and UICollectionViewDelegate protocols respectively.

32 UICollectionViewCell The UICollectionViewCell class is responsible for displaying whatever data is provided to the UICollectionView instance by the data source with one cell corresponding to one data item.

33 UICollectionViewCell There is a clear separation between layout and the contents of a cell. The cell only knows what to display, the sizing and positioning of the cell within the wider context of the collection view is controlled by the layout object assigned to the collection view.

34 Demo Create new project, single view, name Collection View In Main.storyboard, from object library, drag and drop collection view. Control-connect collection view to controller s outlets datasource and delegate.

35 Demo In Attribute inspector set the number of collection view s items to 1. Set ConnectionView s constraints to (0, 0, 0, 0) In Size Inspector, set Min Spacing for Cells and Lines to 0.

36 Demo Select the cell and in Size Inspector, set it to custom size, say, by (iphone 8) In Attributes Inspector, set cell s identifier to datacell From object s library drag and drop image view into the cell at (5, 5), size (177.5, 267.5), constraints to (5, 5, 5, 5). Your Main.storyboard should resemble :

37 Demo Copy images amadeus.jpg, exorcist.jpg, godfather.jpg, jaws.jpg, lord.jpg and scarface.jpg into Project folder.

38 Delegate and Datasource Using Assistant editor, control-connect UICollectionView to ViewController.h and create outlet collectionview. For the data source we ll need NSArray *data :

39 Delegate and Datasource #import ViewController : UIViewController <UICollectionViewDataSource, (strong, nonatomic) IBOutlet UICollectionView (strong, nonatomic) NSArray

40 Delegate and Datasource Create new file CustomCollectionViewCell, subclass of UICollectionViewCell. Using identity inspector, associate UIViewCollectionCell with the newly created class CustomCollectionViewCell.

41 Delegate and Datasource Using Assistant editor, control-connect UIImageView and create an outlet imageview : #import CustomCell : (strong, nonatomic) IBOutlet UIImageView

42 Delegate and Datasource Back to ViewController.m, in viewdidload method we populate array data : _data = @ lord.jpg, nil]; Now we have to implement data source and delegate methods.

43 Delegate and Datasource Our collection view has a single section : -(NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionview { return 1; } Number of items in sections is : -(NSInteger)collectionView:(UICollectionView *)collectionview numberofitemsinsection:(nsinteger)section { return _data.count; }

44 Delegate and Datasource Define the cell : -(UICollectionViewCell *) collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { CustomCollectionViewCell *cell = [collectionview dequeuereusablecellwithreuseidentifier:@"datacell" forindexpath:indexpath]; cell.imageview.image = [UIImage imagenamed: [_data objectatindex:indexpath.row]]; } return cell;

45 Delegate and Datasource Specify cell s width and height: - (CGSize)collectionView:(UICollectionView *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath { CGFloat width = self.view.frame.size.width / 2.0; CGFloat height = 1.44 * width; } return CGSizeMake(width, height);

46 Demo Run.

47 Calendar Our next project will use UICollectionView to display calendar. Create a new project, single view, name Calendar Add Navigation Controller, connect it to the existing view and delete TableView Controller.

48 Calendar Add seven labels (System 12.0), select them all and create horizontal stack, background color RGB (249, 249, 249) Set constraints for the horizontal stack: left (0), top (0), right (0) and height (28). Control connect labels (S - M, M - T, etc.) and set constraint to equal widths.

49 Calendar Under the horizontal stack, place UICollectionView at (0, 92) and set constraints to (0, 0, 0, 0). In Attribute Inspector set Items to 1 and in Accessories select Section Header, Min Spacing for cells and lines to 0. Inside cell and header, place labels ( for month and day ). Set header s height to 32.

50 Calendar Header s label size is (120, 20), font: System 16.0, Constraints: vertically aligned, left >=, height 20, right 8. Cell s label size is (24, 24) horizontally and vertically centered in container, font: System 17.0 Using Identity Inspector, set cell s identifier to calendarcell and header s identifier to calendarheader.

51

52 Calendar We need two custom classes for the header and cell : #import HeaderCollectionReusableView : (weak, nonatomic) IBOutlet UILabel #import CalendarCollectionViewCell : (weak, nonatomic) IBOutlet UILabel

53 Calendar In Main.storyboard, Identity Inspector, associate header and cell with custom classes HeaderCollectionReusableView and CalendarCollectionViewCell, respectively. Control-connect UICollectionView (calendarcollectionview) to the View Controller and set both, datasource and delegate.

54 Calendar Also create an outlet for the top stack. Declare NSMutableArray months. Our ViewController must implement UICollectionView s data source and delegate methods.

55 Calendar This is our ViewController.h : #import ViewController : UIViewController <UICollectionViewDelegate, (weak, nonatomic) IBOutlet UIStrackView (weak, nonatomic) IBOutlet UICollectionView (strong, nonatomic) NSMutableArray

56 Calendar In viewdidload method, we declare and initialize several NSArrays ( storing dates for months ) and add them to mutable array months. _months = [[NSMutableArray alloc] init]; [_months addobject:jan]; [_months addobject:feb]; [_months addobject:mar];

57 Calendar The number of sections in our UICollectionView is the number of months : -(NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionview { return _months.count; }

58 Calendar The number of items in each section is the number of days in month : -(NSInteger)collectionView:(UICollectionView *)collectionview numberofitemsinsection:(nsinteger)section { NSArray *temp = [_months objectatindex:section]; return temp.count; }

59 Calendar Cells are created in pretty much the same way as in UITableView : -(UICollectionViewCell *)collectionview: (UICollectionView *)collectionview cellforitematindexpath: (NSIndexPath *)indexpath { CalendarCell *cell = [collectionview dequeuereusablecellwithreuseidentifier:@"calendarcell" forindexpath:indexpath];

60 Calendar NSArray *temp = [_months objectatindex:indexpath.section]; cell.datenumber.text = [temp objectatindex:indexpath.row]; } if(indexpath.row % 7 == 0 (indexpath.row + 1) % 7 == 0) cell.datenumber.textcolor = [UIColor lightgraycolor]; else cell.datenumber.textcolor = [UIColor blackcolor]; return cell;

61 Calendar Header is somewhat different though: - (UICollectionReusableView *)collectionview: (UICollectionView *)collectionview viewforsupplementaryelementofkind:(nsstring *)kind atindexpath:(nsindexpath *)indexpath { UICollectionReusableView *reusableview = nil; if (kind == UICollectionElementKindSectionHeader) { HeaderCollectionReusableView *headerview = [collectionview dequeuereusablesupplementaryviewofkind: UICollectionElementKindSectionHeader withreuseidentifier:@"header" forindexpath:indexpath];

62 Calendar Now you can customize header view, for example adding a border under the header : UIView *bottomborder = [UIView new]; bottomborder.backgroundcolor = [UIColor lightgraycolor]; bottomborder.frame = CGRectMake(0, headerview.frame.size.height - 1, headerview.frame.size.width, 1); [headerview addsubview:bottomborder]; Finally, return reusable view : return reusableview;

63 Calendar Size of cells is defined in sizeforitematindexpath method: CGFloat width = self.view.frame.size.width / 7.0; CGFloat height = width; In order to handle Portrait/Landscape orientation, implement viewwilllayoutsubviews method.

64 Calendar Run. ( Calendar 1 )

65 Calendar Populating calendar manually isn t the best solution, is it? So, let s use NSCalendar instead. In View Controller we ll need several properties (nonatomic, strong) NSCalendar (nonatomic, strong) NSDate (nonatomic, strong) NSDate (nonatomic, strong) NSDate NSInteger initialsection; In viewdidload method we create calendar, date and date components ( required for accessing days, months, years etc. ) :

66 Calendar if (!_calendar) { [self setcalendar:[nscalendar currentcalendar]]; } _date = [[NSDate alloc] init]; NSDateComponents *components = [_calendar components: NSCalendarUnitYear NSCalendarUnitMonth NSCalendarUnitDay fromdate:_date]; Next we set the initial section of our UICollectionView to the current month : long year = components.year; long month = components.month; _initialsection = (year ) * 12 + month - 1;

67 Calendar The range of our calendar is [ January 2000, December current year + 9 ] : components.day = 1; components.month = 1; components.year = 2000; _firstdate = [_calendar datefromcomponents:components]; components.year = year + 10; components.day = -1; _lastdate = [_calendar datefromcomponents:components];

68 Calendar We want to set initial section to the current month of the current year. For that we set boolean variable: BOOL _viewdidlayoutsubviewsforthefirsttime = YES; We scroll into the initial section in viewdidlayoutsubviews method:

69 Calendar - (void)viewdidlayoutsubviews { [super viewdidlayoutsubviews]; if (_viewdidlayoutsubviewsforthefirsttime) { _viewdidlayoutsubviewsforthefirsttime = NO; UICollectionViewLayoutAttributes *attributes = [_calendarcollectionview layoutattributesforitematindexpath: [NSIndexPath indexpathforrow:0 insection:_initialsection]]; } } CGRect rect = attributes.frame; [_calendarcollectionview setcontentoffset:cgpointmake( _calendarcollectionview.frame.origin.x, rect.origin.y - 32) animated:no];

70 Calendar We ll need a couple of calendar helper methods : - (NSDate *)firstofmonthforsection:(nsinteger)section { NSDateComponents *offset = [NSDateComponents new]; offset.month = section; } return [_calendar datebyaddingcomponents:offset todate:_firstdate options:0]; Which returns the date of the first day in a month depending on UICollectionView s section. Method dateforcellatindexpath returns the date for each cell.

71 Calendar - (NSDate *)dateforcellatindexpath:(nsindexpath *)indexpath { NSDate *firstofmonth = [self firstofmonthforsection:indexpath.section]; NSInteger ordinalityoffirstday = [_calendar ordinalityofunit:nscalendarunitday inunit:nscalendarunitweekofmonth fordate:firstofmonth]; NSDateComponents *datecomponents = [NSDateComponents new]; datecomponents.day = (1 - ordinalityoffirstday) + indexpath.item; } return [_calendar datebyaddingcomponents:datecomponents todate:firstofmonth options:0];

72 Calendar Now the number of sections is : -(NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionview { return [_calendar components:nscalendarunitmonth fromdate:_firstdate todate:_lastdate options:0].month + 1; }

73 Calendar Number of items ( dates ) per section : -(NSInteger)collectionView:(UICollectionView *)collectionview numberofitemsinsection:(nsinteger)section { NSDate *firstofmonth = [self firstofmonthforsection:section]; NSRange rangeofweeks = [_calendar rangeofunit:nscalendarunitweekofmonth inunit:nscalendarunitmonth fordate:firstofmonth]; } int daysperweek = 7; return (rangeofweeks.length * daysperweek);

74 Calendar Cells are assigned values : NSDate *celldate = [self dateforcellatindexpath:indexpath]; NSDateComponents *celldatecomponents = [_calendar components:nscalendarunitday NSCalendarUnitMonth NSCalendarUnitYear fromdate:celldate]; NSDateFormatter *dateformatter; dateformatter = [[NSDateFormatter alloc] init]; dateformatter.dateformat day = [dateformatter stringfromdate:celldate]; cell.datenumber.text = day;

75 Calendar We also set current day s cell background to red and corner radius to 12.0 (since Label s frame is 24x24) cell.datenumber.layer.cornerradius = 12.0; cell.datenumber.clipstobounds = YES; if(celldatecomponents.day == todaycomponents.day && celldatecomponents.month == todaycomponents.month && celldatecomponents.year == todaycomponents.year) { } cell.datenumber.backgroundcolor = [UIColor redcolor]; cell.datenumber.textcolor = [UIColor whitecolor];

76 Calendar Header is handled similarly : NSDateFormatter *headerdateformatter = [[NSDateFormatter alloc] init]; headerdateformatter.calendar = _calendar; headerdateformatter.dateformat = [NSDateFormatter dateformatfromtemplate:@"yyyy LLLL" options:0 locale:_calendar.locale]; NSString *headertitle = [headerdateformatter stringfromdate:[self firstofmonthforsection: indexpath.section]].uppercasestring; headerview.month.text = headertitle; reusableview = headerview;

77 Calendar It would be nice to get back instantly to the current month / date. Back to Main.storyboard, grab Toolbar from Object library and drag it into the View Controller, bottom position, constraints (left:0, bottom 0, right 0, height: 44)

78 Calendar Change button s title to Today and using Assistant editor create IBAction todaybutton : - (IBAction)todayButton:(id)sender;

79 Calendar Finally, implement the code for todaybutton ( similar to viewwilladdsubviews - set section to initial section ) : - (IBAction)todayButton:(id)sender { UICollectionViewLayoutAttributes *attributes = [_calendarview layoutattributesforitematindexpath: [NSIndexPath indexpathforrow:0 insection:_initialsection]]; } CGRect rect = attributes.frame; [_calendarview setcontentoffset: CGPointMake(_calendarView.frame.origin.x, rect.origin.y - 32) animated:no];

80 Calendar Run. ( Custom Calendar 2 )

81 Calendar How would one populate calendar with custom events? First of all, we need a label under the date ( quite tiny 6x6 ). Set constraints to width:6, height: 6, bottom: 2, horizontally centered in container.

82 Calendar Using Assistant Editor create IBOutlet UILabel event and declare boolean property hasevent : #import CalendarCollectionViewCell : (weak, nonatomic) IBOutlet UILabel (strong, nonatomic) IBOutlet UILabel BOOL

83 Calendar Implementation ( CallendarCollectionViewCell.m ) will require prepareforreuse method : - (void)prepareforreuse { [super prepareforreuse]; } _event.backgroundcolor = [UIColor clearcolor]; _event.textcolor = [UIColor blackcolor]; _datenumber.backgroundcolor = [UIColor clearcolor]; _datenumber.textcolor = [UIColor blackcolor]; _hasevent = NO;

84 Calendar In ViewController we declare couple of properties (nonatomic, strong) NSMutableArray (nonatomic, strong) NSDate *selecteddate; In implementation, viewdidload method, create and populate events: _events = [[NSMutableArray alloc] init]; [_events addobject:@" "]; [_events addobject:@" "]; [_events addobject:@" "]; [_events addobject:@" "];

85 Calendar Now we have to implement several delegate methods that handle cell selection : shouldselectitematindexpath: - do not select invisible cells ( those that belong to previous / next month )

86 Calendar didselectitematindexpath: - change date s background colour to grey circle / white text and set the value of selected date. diddeselectitematindexpath: - reset dates background / text colour and handle current date s background colour.

87 Calendar Several helper methods are required as well : isenableddate: - which determines whether the date is selectable or not ( uses in turn clampdate: method ).

88 Calendar isselecteddate: - which determines whether the date is selected or not ( uses in turn clampandcomparedate: method ). istodaydate: - which determines whether the date is today date or not ( uses in turn clampandcomparedate: method ).

89 Calendar Run. ( Custom Calendar 3 )

90 Calendar In order to display event we need a new UIViewController - EventViewController. Create new file and in Identity Inspector associate it with the newly added view controller. Add UILabel (left: 24, top: 68, right: 24, height: 21) and in Assistant Editor create an IBOutlet. Also declare property stringdate.

91 Calendar #import EventViewController : (weak, nonatomic) IBOutlet UILabel (strong, nonatomic) NSString

92 Calendar Since not every cell has an event, we cannot simply connect two controllers - we have to do it programatically. Select the newly added view controller and in Identity Inspector assigned it an ID eventcontroller. Your Main.storyboard should resemble :

93 Calendar

94 Calendar In ViewController, implement didselectitematindexpath: if(cell.hasevent) { NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateformat MMMM d, yyyy"; NSDate *celldate = [self dateforcellatindexpath:indexpath]; NSString *stringdate = [formatter stringfromdate:celldate]; EventViewController *events = [self.storyboard events.stringdate = stringdate; } [self.navigationcontroller pushviewcontroller: events animated:yes];

95 Calendar In EventViewController, implement viewdidload - (void)viewdidload { [super viewdidload]; } self.title _datelabel.text = _stringdate; Run. ( Custom Calendar 4 )

96

97 Tab Bar Controller A tab bar is a control, usually appearing across the bottom of the screen in the context of a tab bar controller, for giving the user one-tap, modal access to a set of views in an app. Each button in a tab bar is called a tab bar item and is an instance of the UITabBarItem class.

98 Tab Bar Controller Create new project, single view, delete default view controller and drag from object library Tab Bar Controller into Main.storyboard.

99 Tab Bar Controller By default, Xcode creates two view controllers. Using Attribute Inspector, set Tab Bar Controller to be the initial view controller. Put couple of labels for each view ( Home, Music )

100 Tab Bar Controller Additional controllers can be added. Drag navigation controller into Main.storyboard. In Table View, set cell s reusable identifier. Control-connect Tab Bar Controller to the Navigation Controller, select Relationship segue: view controllers.

101 Tab Bar Controller

102 Tab Bar Controller Create new class TabBarViewController subclass of UITabBarController. In Identity inspector associate Tab Bar Controller with the newly created class. In order to define text/icons in viewdidload we have :

103 Tab Bar Controller UITabBar *tabbar = self.tabbar; UITabBarItem *tabbaritem1 = [tabbar.items objectatindex:0]; UITabBarItem *tabbaritem2 = [tabbar.items objectatindex:1]; UITabBarItem *tabbaritem3 = [tabbar.items objectatindex:2]; tabbaritem1.title tabbaritem2.title tabbaritem3.title tabbaritem1.image = [UIImage imagenamed:@"home"]; tabbaritem2.image = [UIImage imagenamed:@"music"]; tabbaritem3.image = [UIImage imagenamed:@"movie"]; Run.

104

105 Tab Bar Controller Sometimes we might have to pass data to navigation controller(s). Create new file MovieTableViewController subclass of UITableView controller and associate it with table view, set cell s id to moviecell. In both, TabBarViewController.h and MovieTableViewController.h declare (strong, nonatomic) NSArray *titles;

106 Tab Bar Controller In TabBarViewController.n we access the navigation controller and set movie titles: UINavigationController *nav; nav = [self.viewcontrollers objectatindex:2]; MovieTableViewController *movietableviewcontroller = (MovieTableViewController*) [nav.viewcontrollers objectatindex:0]; of the Scarface"]; movietableviewcontroller.titles = _titles;

107 Tab Bar Controller In MovieTableViewController.n we implement delegate / data source methods: - (NSInteger)numberOfSectionsInTableView: (UITableView *)tableview { } return 1; - (NSInteger)tableView:(UITableView *)tableview numberofrowsinsection:(nsinteger)section { } return [_titles count];

108 Tab Bar Controller - (UITableViewCell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { UITableViewCell *cell = [tableview dequeuereusablecellwithidentifier:@"moviecell" forindexpath:indexpath]; cell.textlabel.text = [_titles objectatindex:indexpath.row]; } return cell; Default color for icons/text in TabBar can be chaged: tabbar.tintcolor = [UIColor colorwithred:255.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:1];

109 Tab Bar Controller

110 UISegmentedControl Similar to UITabBarController, although somewhat simpler. It is a horizontal control made of multiple segments, each segment functioning as a discrete button. A segmented control affords a compact means to group together a number of controls.

111 Segmented Control Create new project and in Main storyboard add Segmented Control and Label. Using assistant editor, create IBAction segmentswitch on Segmented Control and IBOutlet output on Label.

112 segmentswitch - (IBAction)segmentSwitch:(id)sender { } UISegmentedControl *segmentedcontrol = (UISegmentedControl *) sender; NSInteger selectedsegment = segmentedcontrol.selectedsegmentindex; if(selectedsegment == 0) _output.text Segment"; else _output.text Segment";

113

114 UISegmentedControl For more complex layouts one might want to use Container Views. Drag couple of container views into View Controller (same size and constraints). Observe that there is a view controller associated with each container view.

115 UISegmentedControl Change views background colors and add couple of labels. Set proper constraints. Your Main storyboard should resemble:

116

117 UISegmentedControl In viewdidload method we set the initial view to the _firstview by setting its alpha component to 1 (visible) and second view s to 0 (invisible) _firstview.alpha = 1; _secondview.alpha = 0; Similar thing happens in segmentswitch method.

118 - (IBAction)segmentSwitch:(id)sender { } UISegmentedControl *segmentedcontrol = (UISegmentedControl *) sender; NSInteger selectedsegment = segmentedcontrol.selectedsegmentindex; if(selectedsegment == 0) { _firstview.alpha = 1; _secondview.alpha = 0; } else { _firstview.alpha = 0; _secondview.alpha = 1; }

119

120 UISegmentedControl and UITableView Sometimes single table needs to be populated with different data sets based on the state of segmented control. Add UITableView under segmented control, set its constraints and using Connection Inspector connect Delegate and DataSource to ViewController.

121

122 UISegmentedControl and UITableView Using Assistant editor, create IBOutlet tableview. Also, in ViewController.h declare three NSArrays.

123 #import ViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> - (weak, nonatomic) IBOutlet UITableView (strong, nonatomic) NSArray (strong, nonatomic) NSArray (strong, nonatomic) NSArray

124 UISegmentedControl and UITableView In implementation, viewdidload method, initialize arrays and set delegate: _data = _firstdataset; [_tableview setdelegate:self];

125 UISegmentedControl and UITableView Implement delegate/datasource methods. Cell label s text is set to: [_data objectatindex (NSUInteger)indexPath.row]; Data sets are changed in segmentswitch method:

126 - (IBAction)segmentSwitch:(id)sender { } UISegmentedControl *segmentedcontrol = (UISegmentedControl *) sender; NSInteger selectedsegment = segmentedcontrol.selectedsegmentindex; if(selectedsegment == 0) { _data = _firstdataset; } else { _data = _seconddataset; } [_tableview reloaddata];

127

128 Files and Directories ios is, well, OS and consequently has a file system. Each ios application on a device has its own private Documents and tmp directories into which it is permitted to read and write data.

129 Files and Directories The Foundation Framework provides three classes that are indispensable when it comes to working with files and directories: NSFileManager, NSFileHandle and NSData

130 NSFileManager The NSFileManager class can be used to perform basic file and directory operations such as creating, moving, reading and writing files and reading and setting file attributes. In addition, this class provides methods for identifying the current working directory, changing to a new directory, creating directories and listing the contents of a directory.

131 NSFileManager NSFileManager *filemgr = [NSFileManager defaultmanager]; NSArray *dirpaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES ); NSString *docsdir = dirpaths[0];

132 Files Once the path to Documents directory has been found, specified file ( e.g. datafile.dat ) can be created, opened etc. NSString *filename = [docsdir

133 Files if ([filemgr fileexistsatpath: filename]) { NSData *databuffer = [filemgr contentsatpath: filename]; NSString *datastring = [[NSString alloc] initwithdata:databuffer encoding:nsasciistringencoding]; } else { [filemgr createfileatpath: filename contents: nil attributes: nil]; }

134 Files In order to write to a file, we ll use : NSString *content = This is a file content ; [content writetofile:filename atomically:no encoding: NSStringEncodingConversionAllowLossy error:nil];

135

136 SQLite SQLite is an embedded, relational database management system (RDBMS). SQLite is written in the C programming language and therefore using SQLite on ios involves direct calls to C functions and access to C data structures. Create new project ( SQLite Demo ), single view application and in targets, Build Phases, add SQLite library libsqlite3.0.tbd

137 SQLite In ViewController.h we need to import sqlite3.h and declare pointer to database contactdb as well as databasepath : #import <UIKit/UIKit.h> #import (strong, nonatomic) NSString (nonatomic) sqlite3

138

139 SQLite Textfields are 189 x 30 at 94, 140 and 186, horizontally centered. Label is 568 x 21 at 248. Constraints (L:16, T:32, R:16, height: 21). Segmented control is 123 x 29 at 301, horizontally centered, neither segment initially selected. Constraints (T:32, WH)

140 SQLite Create four IBOutlets (name, address, phone and status) for three text fields and one label. Create IBAction savefind for segmented control

141 SQLite #import <UIKit/UIKit.h> #import ViewController : (strong, nonatomic) IBOutlet UITextField (strong, nonatomic) IBOutlet UITextField (strong, nonatomic) IBOutlet UITextField (strong, nonatomic) IBOutlet UILabel *status; - (strong, nonatomic) NSString (nonatomic) sqlite3

142 SQLite As in the case of files, in viewdidload method, first of all we have to see if database contacts.db exists : NSArray *dirpaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); NSString *docsdir = dirpaths[0]; _databasepath = [[NSString alloc] initwithstring: [docsdir stringbyappendingpathcomponent:@"contacts.db"]]; NSFileManager *filemgr = [NSFileManager defaultmanager];

143 SQLite If DB does not exist, we will create it using the sqlite3_open(dbpath, &_contactdb) method and also create table CONTACTS : if ([filemgr fileexistsatpath: _databasepath ] == NO) { const char *dbpath = [_databasepath UTF8String]; if (sqlite3_open(dbpath, &_contactdb) == SQLITE_OK) { char *errmsg; const char *sql_stmt = "CREATE TABLE IF NOT EXISTS CONTACTS (NAME TEXT, ADDRESS TEXT, PHONE TEXT)";

144 SQLite } if (sqlite3_exec(_contactdb, sql_stmt, NULL, NULL, &errmsg)!= SQLITE_OK) { _status.text to create table"; } sqlite3_close(_contactdb); } else { _status.text to open/create database"; }

145 SQLite sqlite3_exec() method takes five arguments: 1. sqlite3 * open database 2. const char *sql string representing SQL statement to be evaluated

146 SQLite 3. int(*callback)(void *, int, char **, char **) callback function ( number of columns, actual values etc, unless NULL ) 4. void * result column(s), unless NULL 5. char **errmsg error message

147 SQLite The saving/finding of contact data to the database is the responsibility of the savefind action method. Statement is defined as in: NSString *querysql * FROM contacts"; const char *query_stmt = [querysql UTF8String];

148 SQLite Query is executed through sqlite3_prepare_v2(), sqlite3_step() and sqlite3_finalize() functions. See source code for details. sqlite3_prepare_v2(_contactdb, query_stmt, -1, &statement, NULL); sqlite3_step(statement); sqlite3_finalize(statement);

149

Apple Development Technology Workshops

Apple Development Technology Workshops Apple Development Technology Workshops Workshop 10 Table Views Building iphone Apps. Pt 2 Fall 2008 Hafez Rouzati Fall 2008 Zach Pousman Last Week UIViewControllers Organizing Content & Building iphone

More information

UICollectionView. NSCoder Milwaukee. 2 April John Psuik. Tuesday, April 2, 13

UICollectionView. NSCoder Milwaukee. 2 April John Psuik. Tuesday, April 2, 13 UICollectionView NSCoder Milwaukee 2 April 2013 John Psuik 1 UICollectionView New to ios 6 Layouts determine placement of items (flowlayout and custom layout) UITableView concepts, but you can do so much

More information

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall Stanford Developing Applications for ios Today Drag and Drop Transferring information around within and between apps. EmojiArt Demo Drag and drop an image to get our EmojiArt masterpieces started. UITableView

More information

App SandBox Directory

App SandBox Directory Data Persistence Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 App SandBox Directory

More information

Naviga&on and Tab Bar Controllers and Table View

Naviga&on and Tab Bar Controllers and Table View Naviga&on and Tab Bar Controllers and Table View UINaviga)onController Stack of view controllers Naviga)on bar How It Fits Together Top view controller s view Top view controller s )tle Previous view controller

More information

ITP 342 Mobile App Dev. Table Views

ITP 342 Mobile App Dev. Table Views ITP 342 Mobile App Dev Table Views Table Views The most common mechanism used to display lists of data to the user Highly configurable objects that can be made to look practically any way you want them

More information

CS193P - Lecture 8. iphone Application Development. Scroll Views & Table Views

CS193P - Lecture 8. iphone Application Development. Scroll Views & Table Views CS193P - Lecture 8 iphone Application Development Scroll Views & Table Views Announcements Presence 1 due tomorrow (4/28)! Questions? Presence 2 due next Tuesday (5/5) Announcements Enrolled students who

More information

Create an App that will drop PushPins onto a map based on addresses that the user inputs.

Create an App that will drop PushPins onto a map based on addresses that the user inputs. Overview Create an App that will drop PushPins onto a map based on addresses that the user inputs. Part 1: Introduction to MKMapKit Part 2: Introduction to PushPins Part 3: Use Google s API to lookup an

More information

Today s Topics. Scroll views Table views. UITableViewController Table view cells. Displaying data Controlling appearance & behavior

Today s Topics. Scroll views Table views. UITableViewController Table view cells. Displaying data Controlling appearance & behavior Today s Topics Scroll views Table views Displaying data Controlling appearance & behavior UITableViewController Table view cells Scroll Views UIScrollView For displaying more content than can fit on the

More information

ITP 342 Mobile App Dev. Collection View

ITP 342 Mobile App Dev. Collection View ITP 342 Mobile App Dev Collection View Collection View A collection view manages an ordered collection of items and presents them in a customizable layout. A collection view: Can contain optional views

More information

Mobile Development - Lab 2

Mobile Development - Lab 2 Mobile Development - Lab 2 Objectives Illustrate the delegation mechanism through examples Use a simple Web service Show how to simply make a hybrid app Display data with a grid layout Delegation pattern

More information

IPHONE DEVELOPMENT. Getting Started with the iphone SDK

IPHONE DEVELOPMENT. Getting Started with the iphone SDK IPHONE DEVELOPMENT Getting Started with the iphone SDK OBJECTIVE-C The Big Picture STRICT SUPERSET OF C The Objective C Language Any C stuff applies Standard libs are here (time, sqrt etc) The C Language

More information

Stanford CS193p. Developing Applications for ios. Winter CS193p! Winter 2015

Stanford CS193p. Developing Applications for ios. Winter CS193p! Winter 2015 Stanford CS193p Developing Applications for ios Today UITextField Bonus Topic! Table View A UIView for displaying long lists or tables of data UITextField Like UILabel, but editable Typing things in on

More information

ios Mobile Development

ios Mobile Development ios Mobile Development Today UITableView! Data source-driven vertical list of views.! ipad! Device-specific UI idioms.! Demo! Shutterbug UITableView Very important class for displaying data in a table!

More information

My First iphone App (for Xcode version 6.4)

My First iphone App (for Xcode version 6.4) My First iphone App (for Xcode version 6.4) 1. Tutorial Overview In this tutorial, you re going to create a very simple application on the iphone or ipod Touch. It has a text field, a label, and a button

More information

Collection Views. Dr. Sarah Abraham

Collection Views. Dr. Sarah Abraham Collection Views Dr. Sarah Abraham University of Texas at Austin CS329e Fall 2016 What is a Collection View? Presents an ordered set of data items in a flexible layout Subclass of UIScrollView (like UITableView)

More information

ios Core Data Example Application

ios Core Data Example Application ios Core Data Example Application The Core Data framework provides an abstract, object oriented interface to database storage within ios applications. This does not require extensive knowledge of database

More information

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar Design Patterns MSc in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

Index. btndrop function, 224, 226 btngetquote function, 246 btnpressed function, 28 btnquote method, 245. CallWeb method, 238, 240

Index. btndrop function, 224, 226 btngetquote function, 246 btnpressed function, 28 btnquote method, 245. CallWeb method, 238, 240 Index A App icons section icons set, 277 LaunchImage, 278 launch screen graphics, 278 279 PNG format, 277 settings, 276 App store deployment application graphics, 273 general settings Identity section,

More information

Praktikum Entwicklung von Mediensystemen mit

Praktikum Entwicklung von Mediensystemen mit Praktikum Entwicklung von Mediensystemen mit Wintersemester 2013/2014 Christian Weiß, Dr. Alexander De Luca Today Table View Navigation Controller Passing Data Between Scenes Assignment 2 2 Navigation-based

More information

Data IAP 2010 iphonedev.csail.mit.edu edward benson / Thursday, January 14, 2010

Data IAP 2010 iphonedev.csail.mit.edu edward benson / Thursday, January 14, 2010 Data IAP 2010 iphonedev.csail.mit.edu edward benson / eob@csail.mit.edu Today Property Lists User Defaults Settings Panels CoreData Property Lists Today Add persistence. plist 1. Using Property Lists in

More information

Chapter 22 TableView TableView. TableView ios. ViewController. Cell TableViewCell TableView

Chapter 22 TableView TableView. TableView ios. ViewController. Cell TableViewCell TableView Chapter 22 TableView TableView Android TableView ListView App 22.1 TableView TableView Storyboard Table View ViewController TableView ios Cell TableViewCell TableView Table View Cell Cell ImageView (imageview)

More information

ITP 342 Mobile App Dev. Table Views

ITP 342 Mobile App Dev. Table Views ITP 342 Mobile App Dev Table Views Tables A table presents data as a scrolling, singlecolumn list of rows that can be divided into sections or groups. Use a table to display large or small amounts of information

More information

Mobile Application Development

Mobile Application Development Mobile Application Development Lecture 16 Controllers of View Controllers 2013/2014 Parma Università degli Studi di Parma Lecture Summary Multiple MVCs UINavigationController Segues UITabBarController

More information

Social Pinboard: ios(swift) Application

Social Pinboard: ios(swift) Application Social Pinboard: ios(swift) Application Document Version 1.0.1 Date: 15 th May, 2015 2 [SOCIAL PINBOARD: APP DOCUMENTATION] Important Notes:... 5 AppDelegate Class Reference... 6 Tasks... 6 Instance Methods...

More information

Contents. iphone Training. Industry Trainers. Classroom Training Online Training ON-DEMAND Training. Read what you need

Contents. iphone Training. Industry Trainers. Classroom Training Online Training ON-DEMAND Training. Read what you need iphone Training Contents About iphone Training Our ios training classes can help you get off to a running start in iphone, ipod and ipad app development. Learn from expert Objective-C developers with years

More information

InterfaceBuilder and user interfaces

InterfaceBuilder and user interfaces ES3 Lab 2 InterfaceBuilder and user interfaces This lab InterfaceBuilder Creating components Linking them to your code Adding buttons, labels, sliders UITableView Creating a tableview Customizing cells

More information

ITP 342 Mobile App Dev. Connections

ITP 342 Mobile App Dev. Connections ITP 342 Mobile App Dev Connections User Interface Interactions First project displayed information to the user, but there was no interaction. We want the users of our app to touch UI components such as

More information

AdFalcon ios Native Ad SDK Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

AdFalcon ios Native Ad SDK Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group AdFalcon ios Native Ad SDK 3.1.0 Developer's Guide AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group Table of Contents 1 Introduction... 4 Native Ads Overview... 4 OS version support...

More information

Tables. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder

Tables. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Tables Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Outline Table View Controller Table View Table Cells

More information

A Mad Libs app that you will navigate through 3 UIViewControllers to add text that will be shown in a story on the fourth UIViewController.

A Mad Libs app that you will navigate through 3 UIViewControllers to add text that will be shown in a story on the fourth UIViewController. WordPlay App: A Mad Libs app that you will navigate through 3 UIViewControllers to add text that will be shown in a story on the fourth UIViewController. Create a new project Create a new Xcode project

More information

Advanced ios. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 20 11/01/2012

Advanced ios. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 20 11/01/2012 Advanced ios CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 20 11/01/2012 1 Goals of the Lecture Present a few additional topics and concepts related to ios programming persistence serialization

More information

Introductory ios Development

Introductory ios Development Introductory ios Development 152-164 Unit 5 - Multi-View Apps Quick Links & Text References What is a Delegate? What is a Protocol? Delegates, Protocols and TableViews Creating a Master-Detail App Modifying

More information

CS193P - Lecture 7. iphone Application Development. Navigation & Tab Bar Controllers

CS193P - Lecture 7. iphone Application Development. Navigation & Tab Bar Controllers CS193P - Lecture 7 iphone Application Development Navigation & Tab Bar Controllers 1 Announcements Assignment 3 is due tomorrow Paparazzi 1 is due on Wednesday February 3rd 2 Today s Topics Navigation

More information

CSC 581: Mobile App Development Spring 2018

CSC 581: Mobile App Development Spring 2018 CSC 581: Mobile App Development Spring 2018 Unit 2: Introduciton to the UIKit UIKit, UIViews UIControl subclasses 1 UIKit the UIKit is a code framework for building mobile apps the foundational class for

More information

Document Version Date: 1st March, 2015

Document Version Date: 1st March, 2015 7 Minute Fitness: ios(swift) Application Document Version 1.0.1 Date: 1st March, 2015 2 [7 MINUTE FITNESS: APP DOCUMENTATION] Important Notes:... 5 AppDelegate Class Reference... 6 Tasks... 6 Instance

More information

ios Development Lecture 3 Controllers of View Controllers Ing. Simone Cirani

ios Development Lecture 3 Controllers of View Controllers Ing. Simone Cirani ios Development Lecture 3 Controllers of View Controllers Ing. Simone Cirani email: simone.cirani@unipr.it http://www.tlc.unipr.it/cirani Corso IFTS Cisita ios Development 2014 Parma Università degli Studi

More information

Step 1: Open Xcode and select Create a new Xcode Project from the Welcome to Xcode menu.

Step 1: Open Xcode and select Create a new Xcode Project from the Welcome to Xcode menu. In this tutorial we are going to build a simple calculator using buttons that are all linked together using the same method. We will also add our own method to the source code to create some additional

More information

Navigation bar (Xcode version 4.5.2) 1. Create a new project. From the Xcode menu, select File > New > Project

Navigation bar (Xcode version 4.5.2) 1. Create a new project. From the Xcode menu, select File > New > Project Navigation bar (Xcode version 4.5.2) 1. Create a new project. From the Xcode menu, select File > New > Project Choose the Single View Application template Click Next. In the Choose options for your new

More information

Corrections and version notes

Corrections and version notes Last updated 7 th May, 2014 Programming apps for the iphone Corrections and version notes Please feel free to email Graeme (gbsummers@graemesummers.info) for additional help or clarification on any of

More information

View Controller Lifecycle

View Controller Lifecycle View Controller Lifecycle View Controllers have a Lifecycle A sequence of messages is sent to them as they progress through it Why does this matter? You very commonly override these methods to do certain

More information

My First iphone App. 1. Tutorial Overview

My First iphone App. 1. Tutorial Overview My First iphone App 1. Tutorial Overview In this tutorial, you re going to create a very simple application on the iphone or ipod Touch. It has a text field, a label, and a button. You can type your name

More information

ios Development - Xcode IDE

ios Development - Xcode IDE ios Development - Xcode IDE To develop ios applications, you need to have an Apple device like MacBook Pro, Mac Mini, or any Apple device with OS X operating system, and the following Xcode It can be downloaded

More information

Widget Tour. iphone and ipod touch Development Fall 2009 Lecture 7

Widget Tour. iphone and ipod touch Development Fall 2009 Lecture 7 Widget Tour iphone and ipod touch Development Fall 2009 Lecture 7 Questions? Announcements Assignment #2 due Tonight by 11:59pm Today s Topics Controls Buttons Switches Sliders Segmented Controls Text

More information

epicurious Anatomy of an ios app Robert Tolar Haining June 25, 2010 ConvergeSE

epicurious Anatomy of an ios app Robert Tolar Haining June 25, 2010 ConvergeSE epicurious Anatomy of an ios app Robert Tolar Haining June 25, 2010 ConvergeSE + = Prototype iphone ipad Why iphone apps Simplicity Control Speed Revenue Epicurious Defined as a Recipe Utility Cookbook

More information

INTRODUCTION TO COLLECTION VIEWS

INTRODUCTION TO COLLECTION VIEWS INTRODUCTION TO COLLECTION VIEWS Using MonoTouch and C# Mike Bluestein Xamarin 11/7/2012 MONOTOUCH Platform for creating ios application with C# from Xamarin Bindings to native APIs Reuse of C# code and

More information

Intro to Native ios Development. Dave Koziol Arbormoon Software, Inc.

Intro to Native ios Development. Dave Koziol Arbormoon Software, Inc. Intro to Native ios Development Dave Koziol Arbormoon Software, Inc. About Me Long time Apple Developer (20 WWDCs) Organizer Ann Arbor CocoaHeads President & ios Developer at Arbormoon Software Inc. Wunder

More information

ITP 342 Mobile App Development. Data Persistence

ITP 342 Mobile App Development. Data Persistence ITP 342 Mobile App Development Data Persistence Persistent Storage Want our app to save its data to persistent storage Any form of nonvolatile storage that survives a restart of the device Want a user

More information

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011 Developing Applications for ios Today UI Element of the Week UIToolbar ipad Split View Popover Universal (iphone + ipad) Application Demo Friday Section AVFoundation framework - Capturing and manipulating

More information

imate: ios Application

imate: ios Application imate: ios Application Document Version 1.0.1 Date: 27 th May, 2014 2 [IMATE: IOS APPLICATION] Contents AppDelegate Class Reference... 4 Tasks... 4 Properties... 4 Instance Methods... 4 ChatMenuViewController

More information

Building GUIs with UIKit. Kevin Cathey

Building GUIs with UIKit. Kevin Cathey Building GUIs with UIKit Kevin Cathey Building GUIs with UIKit acm.uiuc.edu/macwarriors/devphone Building GUIs with UIKit What is UIKit? acm.uiuc.edu/macwarriors/devphone Building GUIs with UIKit What

More information

A Vertical Slider for iphone

A Vertical Slider for iphone A Vertical Slider for iphone The UISlider control offers a way to continuously get values from the user within a range of set values. In the Interface Builder library of controls, there is only a horizontal

More information

Building Mapping Apps for ios With Swift

Building Mapping Apps for ios With Swift Building Mapping Apps for ios With Swift Jeff Linwood This book is for sale at http://leanpub.com/buildingmappingappsforioswithswift This version was published on 2017-09-09 This is a Leanpub book. Leanpub

More information

Covers ios 6. Bear Cahill. Includes 98 Techniques MANNING

Covers ios 6. Bear Cahill. Includes 98 Techniques MANNING Bear Cahill Covers ios 6 Includes 98 Techniques MANNING ios in Practice by Bear Cahill Chapter 5 Copyright 2012 Manning Publications brief contents PART 1 GETTING STARTED...1 1 Getting started with ios

More information

ITP 342 Mobile App Development. Data Persistence

ITP 342 Mobile App Development. Data Persistence ITP 342 Mobile App Development Data Persistence Persistent Storage Want our app to save its data to persistent storage Any form of nonvolatile storage that survives a restart of the device Want a user

More information

IOS - TEXT FIELD. Use of Text Field. Important Properties of Text Field. Updating Properties in xib

IOS - TEXT FIELD. Use of Text Field. Important Properties of Text Field. Updating Properties in xib IOS - TEXT FIELD http://www.tutorialspoint.com/ios/ios_ui_elements_text_field.htm Copyright tutorialspoint.com Use of Text Field A text field is a UI element that enables the app to get user input. A UITextfield

More information

Review. Objective-C Classes, Methods, Properties, Protocols, Delegation, Memory Management

Review. Objective-C Classes, Methods, Properties, Protocols, Delegation, Memory Management Data Persistence Review Objective-C Classes, Methods, Properties, Protocols, Delegation, Memory Management Foundation NSArray, NSDictionary, NSString (and mutable versions thereof) MVC and UIViewController

More information

View Concepts. iphone Application Programming Lecture 4: User Interface Design. SDK provide many types of Views to show your content

View Concepts. iphone Application Programming Lecture 4: User Interface Design. SDK provide many types of Views to show your content View Concepts iphone Application Programming Lecture 4: User Interface Design SDK provide many types of Views to show your content At run-time Views are organized as a tree Chat Wacharamanotham Media Computing

More information

iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin Flashlight CodeTour TouchCount CodeTour

iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin Flashlight CodeTour TouchCount CodeTour iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin 1 Legal Info iphone is a trademark of Apple Inc. Servin is a trademark of Servin Corporation 2 Welcome Welcome! Thank you! My promise

More information

Assignment IV: Smashtag Mentions

Assignment IV: Smashtag Mentions Assignment IV: Smashtag Mentions Objective In this assignment, you will enhance the Smashtag application that we built in class to give ready-access to hashtags, urls, images and users mentioned in a tweet.

More information

Objective-C Primer. iphone Programmer s Association. Lorenzo Swank September 10, 2008

Objective-C Primer. iphone Programmer s Association. Lorenzo Swank September 10, 2008 Objective-C Primer iphone Programmer s Association Lorenzo Swank September 10, 2008 Disclaimer Content was blatantly and unapologetically stolen from the WWDC 2007 Fundamentals of Cocoa session, as well

More information

OVERVIEW. Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net

OVERVIEW. Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net OVERVIEW Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net Microsoft MVP for 4 years C#, WinForms, WPF, Silverlight Joined Cynergy about

More information

Life Cycle. Chapter Explore the Game Application. Understanding the Views in a Game

Life Cycle. Chapter Explore the Game Application. Understanding the Views in a Game 3 Chapter Explore the Game Application Life Cycle There is more to a game than just the fun parts. Almost all of the games on the market, and definitely the big titles, involve multiple views and a reasonably

More information

News- ipad: ios(swift) Application

News- ipad: ios(swift) Application News- ipad: ios(swift) Application Document Version 1.0.1 Date: 9 th Nov, 2014 2 [NEWS- IPAD: APP DOCUMENTATION] Important Notes:... 6 AppDelegate Class Reference... 7 Tasks... 7 Instance Methods... 7

More information

Designing iphone Applications

Designing iphone Applications Designing iphone Applications 4 Two Flavors of Mail 5 Organizing Content 6 Organizing Content 6 Organizing Content 6 Organizing Content 6 Organizing Content Focus on your user s data 6 Organizing Content

More information

Collection Views Hands-On Challenges

Collection Views Hands-On Challenges Collection Views Hands-On Challenges Copyright 2015 Razeware LLC. All rights reserved. No part of this book or corresponding materials (such as text, images, or source code) may be reproduced or distributed

More information

AVAudioRecorder & System Sound Services

AVAudioRecorder & System Sound Services AVAudioRecorder & System Sound Services Dept. of Multimedia Science, Sookmyung Women s University. prof. JongWoo Lee Index AVAudioRecorder? - (AudioRecorder) System Sound Service? - (SysSound) AVAudioRecorder

More information

Developing Applications for ios

Developing Applications for ios Developing Applications for ios Lab 2: RPN Calculator App (1 of 3) Radu Ionescu raducu.ionescu@gmail.com Faculty of Mathematics and Computer Science University of Bucharest Task 1 Task: Create a new application

More information

SAMPLE CHAPTER. Brendan G. Lim Martin Conte Mac Donell MANNING

SAMPLE CHAPTER. Brendan G. Lim Martin Conte Mac Donell MANNING SAMPLE CHAPTER Brendan G. Lim Martin Conte Mac Donell MANNING ios 7 in Action by Brendan G. Lim Martin Conte Mac Donell Chapter 2 Copyright 2014 Manning Publications brief contents PART 1 BASICS AND NECESSITIES...1

More information

A Mobile Mapping Application

A Mobile Mapping Application A Mobile Mapping Application MANNING SHELTER ISLAND A Mobile Mapping Application A special edition ebook Copyright 2013 Manning Publications contents about mobile mapping about this ebook v about the authors

More information

ITP 342 Mobile App Dev. Web View

ITP 342 Mobile App Dev. Web View ITP 342 Mobile App Dev Web View Web View 2 WebKit The WebKit provides a set of core classes to display web content in windows, and by default, implements features such as following links clicked by the

More information

ITP 342 Mobile App Dev. Connections

ITP 342 Mobile App Dev. Connections ITP 342 Mobile App Dev Connections User Interface Interactions First project displayed information to the user, but there was no interaction. We want the users of our app to touch UI components such as

More information

src3/bettertextfield/bettertextfield/appdelegate.h // AppDelegate.h // BetterTextField

src3/bettertextfield/bettertextfield/appdelegate.h // AppDelegate.h // BetterTextField src3/bettertextfield/bettertextfield/appdelegate.h 1 1 1 1 AppDelegate.h BetterTextField Created by Tommy MacWilliam on 3/7/ Copyright (c) 2012 MyCompanyName. All rights reserved. #import

More information

ITP 342 Advanced Mobile App Dev. Core Data

ITP 342 Advanced Mobile App Dev. Core Data ITP 342 Advanced Mobile App Dev Core Data Persistent Data NSUser Defaults Typically used to save app preferences Property List (plist) in Documents Directory Data is in a dictionary or an array Coders

More information

Introduction to WatchKit. CS193W - Spring Lecture 1

Introduction to WatchKit. CS193W - Spring Lecture 1 Introduction to WatchKit CS193W - Spring 2016 - Lecture 1 appleᴡᴀᴛᴄʜ Released April 24, 2015 No updates to the hardware yet. Three collections, over 30 models Two sizes The Screen OLED (organic light-emitting

More information

Praktikum Entwicklung von Mediensystemen mit ios

Praktikum Entwicklung von Mediensystemen mit ios Praktikum Entwicklung von Mediensystemen mit ios WS 2011 Prof. Dr. Michael Rohs michael.rohs@ifi.lmu.de MHCI Lab, LMU München Today Storyboards Automatic Reference Counting Animations Exercise 3 2 Timeline

More information

ios Mobile Development

ios Mobile Development ios Mobile Development Today UITextView Scrollable, editable/selectable view of a mutable attributed string. View Controller Lifecycle Finding out what s happening as a VC is created, hooked up to the

More information

Topics in Mobile Computing

Topics in Mobile Computing Topics in Mobile Computing Workshop 1I - ios Fundamental Prepared by Y.H. KWOK What is ios? From Wikipedia (http://en.wikipedia.org/wiki/ios): ios is an operating system for iphone, ipad and Apple TV.

More information

ios 101 Hands-On Challenges

ios 101 Hands-On Challenges ios 101 Hands-On Challenges Copyright 2014 Razeware LLC. All rights reserved. No part of this book or corresponding materials (such as text, images, or source code) may be reproduced or distributed by

More information

The MVC Design Pattern

The MVC Design Pattern The MVC Design Pattern The structure of iphone applications is based on the Model-View-Controller (MVC) design pattern because it benefits object-oriented programs in several ways. MVC based programs tend

More information

iphone App Basics iphone and ipod touch Development Fall 2009 Lecture 5

iphone App Basics iphone and ipod touch Development Fall 2009 Lecture 5 iphone App Basics iphone and ipod touch Development Fall 2009 Lecture 5 Questions? Announcements Assignment #1 due this evening by 11:59pm Remember, if you wish to use a free late you must email me before

More information

COPYRIGHTED MATERIAL. part I Developing a Professional UI. Chapter 1: Creating a Personal Library. Chapter 2: Advancing with Tableviews

COPYRIGHTED MATERIAL. part I Developing a Professional UI. Chapter 1: Creating a Personal Library. Chapter 2: Advancing with Tableviews part I Developing a Professional UI Chapter 1: Creating a Personal Library Chapter 2: Advancing with Tableviews Chapter 3: Advancing with Map Kit Chapter 4: Understanding Action Views and Alerts Chapter

More information

lectures/2/src2/nib1/nib1/appdelegate.h // AppDelegate.h // Nib1 // David J. Malan // Harvard University //

lectures/2/src2/nib1/nib1/appdelegate.h // AppDelegate.h // Nib1 // David J. Malan // Harvard University // lectures/2/src2/nib1/nib1/appdelegate.h 1 1 1 1 1 1 1 1 1 2 AppDelegate.h Nib1 David J. Malan Harvard University malan@harvard.edu Demonstrates a Single View Application implemented with a nib, plus IBAction

More information

View Concepts. iphone Application Programming Lecture 4: User Interface Design. SDK provide many types of Views to show your content

View Concepts. iphone Application Programming Lecture 4: User Interface Design. SDK provide many types of Views to show your content View Concepts iphone Application Programming Lecture 4: User Interface Design SDK provide many types of Views to show your content At run-time Views are organized as a tree Chat Wacharamanotham Media Computing

More information

Building the App - Part 5 - Adding a Link

Building the App - Part 5 - Adding a Link Unit 4 - Coding For Your App Copy and Paste the code below exactly where the tutorials tell you. DO NOT COPY TEXT IN RED. Building the App - Part 5 - Adding a Link XCODE 7 @IBAction func Button1(_ sender:

More information

Stanford CS193p. Developing Applications for iphone 4, ipod Touch, & ipad Fall Stanford CS193p Fall 2010

Stanford CS193p. Developing Applications for iphone 4, ipod Touch, & ipad Fall Stanford CS193p Fall 2010 Developing Applications for iphone 4, ipod Touch, & ipad Today More Core Data What does the code for the custom NSManagedObject subclasses generated by Xcode look like? Querying for (fetching) objects

More information

Developing Applications for ios

Developing Applications for ios Developing Applications for ios Lab 10: Nearby Deals (6 of 6) Radu Ionescu raducu.ionescu@gmail.com Faculty of Mathematics and Computer Science University of Bucharest Task 1 Task: Save the favorite deals

More information

Xcode 4 Cookbook. Steven F. Daniel. Chapter No. 2 "User Interfaces Creating the UI"

Xcode 4 Cookbook. Steven F. Daniel. Chapter No. 2 User Interfaces Creating the UI Xcode 4 Cookbook Steven F. Daniel Chapter No. 2 "User Interfaces Creating the UI" In this package, you will find: A Biography of the author of the book A preview chapter from the book, Chapter NO.2 "User

More information

Apple introduced MapKit with ios, maps were based on Google.

Apple introduced MapKit with ios, maps were based on Google. History: Apple introduced MapKit with ios, maps were based on Google. With ios 6.0, Apple provided its own mapping service, which lacked some quality, especially level-of-detail. With ios 7 Apple opened

More information

ITP 342 Mobile App Dev. Delegates

ITP 342 Mobile App Dev. Delegates ITP 342 Mobile App Dev Delegates Protocol A protocol is a declaration of a list of methods Classes that conform to the protocol implement those methods A protocol can declare two kinds of methods: required

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer About the Tutorial ios is a mobile operating system developed and distributed by Apple Inc. It was originally released in 2007 for the iphone, ipod Touch, and Apple TV. ios is derived from OS X, with which

More information

Structuring an App Copyright 2013 Apple Inc. All Rights Reserved.

Structuring an App Copyright 2013 Apple Inc. All Rights Reserved. Structuring an App App Development Process (page 30) Designing a User Interface (page 36) Defining the Interaction (page 42) Tutorial: Storyboards (page 47) 29 App Development Process Although the task

More information

Integrating Game Center into a BuzzTouch 1.5 app

Integrating Game Center into a BuzzTouch 1.5 app into a BuzzTouch 1.5 app This tutorial assumes you have created your app and downloaded the source code; created an App ID in the ios Provisioning Portal, and registered your app in itunes Connect. Step

More information

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011 Developing Applications for ios Views A view (i.e. UIView subclass) represents a rectangular area Defines a coordinate space Draws and handles events in that rectangle Hierarchical A view has only one

More information

Developing Applications for ios

Developing Applications for ios Developing Applications for ios Lecture 7: View Controller Lifecycle and UIKit Radu Ionescu raducu.ionescu@gmail.com Faculty of Mathematics and Computer Science University of Bucharest Content View Controller

More information

Using Advanced Interface Objects and Views

Using Advanced Interface Objects and Views HOUR 9 Using Advanced Interface Objects and Views What You ll Learn This Hour:. How to use segmented controls (a.k.a. button bars). Ways of inputting Boolean values via switches. How to include web content

More information

iphone Application Programming Lecture 5: View Programming

iphone Application Programming Lecture 5: View Programming Lecture 5: View Programming Nur Al-huda Hamdan RWTH Aachen University Winter Semester 2015/2016 http://hci.rwth-aachen.de/iphone Name the UI Elements In the Screen 2 View Programming 3 View Programming

More information

ITP 342 Mobile App Dev. Locations and Maps

ITP 342 Mobile App Dev. Locations and Maps ITP 342 Mobile App Dev Locations and Maps Locations and Maps Every ios device has the ability to determine where in the world it is Create a live interactive map showing any locations you like, including

More information

Assignment III: Graphing Calculator

Assignment III: Graphing Calculator Assignment III: Graphing Calculator Objective The goal of this assignment is to reuse your CalculatorBrain and CalculatorViewController objects to build a Graphing Calculator for iphone and ipad. By doing

More information

Objectives. Submission. Register for an Apple account. Notes on Saving Projects. Xcode Shortcuts. CprE 388 Lab 1: Introduction to Xcode

Objectives. Submission. Register for an Apple account. Notes on Saving Projects. Xcode Shortcuts. CprE 388 Lab 1: Introduction to Xcode Objectives Register for an Apple account Create an application using Xcode Test your application with the iphone simulator Import certificates for development Build your application to the device Expand

More information