|
|
libcats.org
Главная →
iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch (Wiley)iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch (Wiley)Maher AliI bought this book because I was struggling with some detail with navigation controllers. The book seemed to have the answer. Sadly the first example I looked at is flawed. In chapter 9, page 278 is the code line self.navigationItem.backBarButtonItem.title = @"Shows"; This is an attempt to give a title to a backBarButtonItem that does not exist at the root level of the navigation hierarchy. Page 276 shows a screenshot without the button or its impossible label, so the author should have picked up that the code was not working. Further into the nav hierarchy, the book (and downloaded source code from which I copied and pasted these code snippets), tries to name the backBarButtonItem again. e.g. self.navigationItem.backBarButtonItem.title = [delegate showNameAtIndex:delegate.selectedShow.row]; (p280 in the book). This does not work, despite its impressive sophistication. The back bar button title is derived from the title of the view from which we moved. (The screenshots on p276 and 277 show that this code line is ineffective and unnecessary, the navcontroller did all the work anyway. Again, the author should have realised that the code was not working, because it is obvious from the screenshots he supplied.) I have experimented with commenting out lines of his code and am satisfied that there is a conceptual error here. It would seem to be a major conceptual error, judging from the number of blogs, discussion groups etc on this very topic. After a couple of days struggling with this, I reviewed the Apple sample code again, and finally realised my conceptual error-shared, it would seem, with many others.
The NavBar sample code from Apple is clear on how to get out of a navigation hierarchy. The "Done" button we all wanted here should be set up in a sequence like this: - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { if (self = [super initWithNibName:nibName bundle:nibBundle]) { self.wantsFullScreenLayout = NO; self.title = @"Intervals"; UIBarButtonItem *addButton = [[[UIBarButtonItem alloc] initWithTitle:(@"Done") style:UIBarButtonItemStyleBordered target:self action:@selector(doneAction:)] autorelease]; self.navigationItem.rightBarButtonItem = addButton; } return self; } - (void)doneAction:(id)sender { // the Done button was clicked, handle it here } That having been said, as a hobby programmer who has been having fun since the days of Fortran 4, I found the introductory sections of the book lucid and certainly added value over the freely available documentation from Apple. Sometimes we need someone to pull stuff together, to select the key stuff. In part, this book does that. It is also very full of examples and distinguishes itself from similar books by the range and usefulness of the examples. Pity about the profound error in the chapter I started with. I hope it is the only one, because I shall be continuing to use this book.
Популярные книги за неделю:
Проектирование и строительство. Дом, квартира, садАвтор: Петер Нойферт, Автор: Людвиг Нефф
Размер книги: 20.83 Mb
Система упражнений по развитию способностей человека (Практическое пособие)Автор: Петров Аркадий НаумовичКатегория: Путь к себе
Размер книги: 818 Kb
Сотворение мира (3-х томник)Автор: Петров Аркадий НаумовичКатегория: Путь к себе
Размер книги: 817 Kb
Радиолюбительские схемы на ИС типа 555Автор: Трейстер Р.Категория: Электротехника и связь
Размер книги: 13.64 Mb
Только что пользователи скачали эти книги:
C Dale Brittain - Wizard of Yurt 1 - 1991 - A Bad Spell in YurtАвтор: Brite Poppy Z
Размер книги: 449 Kb
Основы теплопередачиАвтор: Михеев М.А., Автор: Михеева И.М.Категория: Отопление, вентиляция
Размер книги: 2.66 Mb
On Some Statistical Properties of Double Stars in Space I. A Formula for the Estimation of the Period in a Relatively Fixed SystemАвтор: Luyten W. J.
Размер книги: 418 Kb
Neanderthals Revisited: New Approaches and PerspectivesАвтор: Katerina Harvati, Автор: Terry Harrison
Размер книги: 6.85 Mb
Технология производства продуктов питания (раздел ''Технология производства молока и молочных продуктов''): Методические указания к лабораторно-практическим занятиямАвтор: Романова А.В.Категория: Молочная промышленность
Размер книги: 213 Kb
The Matrix Repatterning Program For Pain Relief: Self-treatment For Musculoskeletal Pain (New Harbinger Self-Help Workbook)Автор: George Roth
Размер книги: 5.64 Mb
Microbiological Aspects of Biofilms and Drinking Water (Microbiology of Extreme and Unusual Environments)Автор: Steven Lane Percival, Автор: James Taggari Walker, Автор: Paul R. Hunter
Размер книги: 1.33 Mb
|
|
|