Merge lp:~mikemc/ubuntuone-ios-music/back-to-5.1 into lp:ubuntuone-ios-music

Proposed by Mike McCracken
Status: Merged
Approved by: Paul Hummer
Approved revision: 261
Merged at revision: 259
Proposed branch: lp:~mikemc/ubuntuone-ios-music/back-to-5.1
Merge into: lp:ubuntuone-ios-music
Diff against target: 64 lines (+18/-5)
3 files modified
Music/View Controllers/AlbumViewController.m (+7/-1)
Music/View Controllers/ArtistViewController.m (+8/-1)
Music/View Controllers/UOIndexedViewController.m (+3/-3)
To merge this branch: bzr merge lp:~mikemc/ubuntuone-ios-music/back-to-5.1
Reviewer Review Type Date Requested Status
Paul Hummer (community) Approve
Review via email: mp+154126@code.launchpad.net

Commit message

A couple of minor changes to build correctly with 5.1 SDK.

Description of the change

A couple of minor changes to build correctly with 5.1 SDK.

As far as I could tell, the extra indexpath arg on the dequeue function is just an optimization.
The other change is just syntax.

To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

I wonder if there's value in putting this in conditionals, like:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0f) {
    // Do iOS 5 stuff
} else {
    // Do iOS 6 stuff
}

Then we've clearly marked places where a bump to minimum iOS 6 could clear out some easy code.

Revision history for this message
Mike McCracken (mikemc) wrote :

Good idea, done. I had to do the check at compile time though, since the symbol doesn't exist in the 5.1 SDK so it won't build if we try to do it at runtime.

260. By Mike McCracken

Use new dequeue method when compiling for iOS 6+, and clearly mark a place where old code can be removed when we drop support for iOS 5.

261. By Mike McCracken

Conditionally use iOS6 only dequeue function. Mark for future droppings.

Revision history for this message
Paul Hummer (rockstar) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Music/View Controllers/AlbumViewController.m'
2--- Music/View Controllers/AlbumViewController.m 2013-02-13 06:37:52 +0000
3+++ Music/View Controllers/AlbumViewController.m 2013-03-19 16:44:21 +0000
4@@ -97,7 +97,13 @@
5
6 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
7 static NSString *CellIndentifier = @"Cell";
8- SongCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIndentifier forIndexPath:indexPath];
9+ SongCell *cell;
10+#ifdef __IPHONE_6_0
11+ cell = [self.tableView dequeueReusableCellWithIdentifier:CellIndentifier forIndexPath:indexPath];
12+#else
13+ // iOS 5
14+ cell = [self.tableView dequeueReusableCellWithIdentifier:CellIndentifier];
15+#endif
16 Song *song = [tableData objectAtIndex:indexPath.row];
17 cell.showArt = NO;
18 [cell setSong:song];
19
20=== modified file 'Music/View Controllers/ArtistViewController.m'
21--- Music/View Controllers/ArtistViewController.m 2013-02-11 03:55:13 +0000
22+++ Music/View Controllers/ArtistViewController.m 2013-03-19 16:44:21 +0000
23@@ -90,7 +90,14 @@
24
25 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
26 static NSString *CellIndentifier = @"Cell";
27- AlbumCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIndentifier forIndexPath:indexPath];
28+ AlbumCell *cell;
29+#ifdef __IPHONE_6_0
30+ cell = [self.tableView dequeueReusableCellWithIdentifier:CellIndentifier forIndexPath:indexPath];
31+#else
32+ // iOS 5
33+ cell = [self.tableView dequeueReusableCellWithIdentifier:CellIndentifier];
34+#endif
35+
36 Album *album = [tableData objectAtIndex:indexPath.row];
37 [cell setAlbum:album];
38 return cell;
39
40=== modified file 'Music/View Controllers/UOIndexedViewController.m'
41--- Music/View Controllers/UOIndexedViewController.m 2013-02-07 06:37:58 +0000
42+++ Music/View Controllers/UOIndexedViewController.m 2013-03-19 16:44:21 +0000
43@@ -85,18 +85,18 @@
44 }
45
46 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
47- id <NSFetchedResultsSectionInfo> sectionInfo = [self.fetchedResultsController sections][section];
48+ id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
49 return [sectionInfo numberOfObjects];
50 }
51
52 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
53- id <NSFetchedResultsSectionInfo> sectionInfo = [self.fetchedResultsController sections][section];
54+ id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
55 return [sectionInfo name];
56 }
57
58 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
59 static NSString *CellIdentifier = @"Cell";
60- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
61+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
62
63 [self configureCell:cell forIndexPath:indexPath];
64 return cell;

Subscribers

People subscribed via source and target branches