ios - Can't display on the screen, Xcode6.1.1 -


so searching day long , fixed still, can't display. so, here deal:

i have started writing xcode 3 days, , following lectures of stanford, online, codes lecture codes. although everthing same lecture codes, code can't display words taken internet. purpose build dictionary , move on writing if able see words on simulation device, iphone 6.

what can't understand is, send message window , said take navigation controller, in pushed wordlistviewcontroller (you can see in below code, in appdelegate.m segment).

you can find code below:

wordlisttableviewcontroller.h

// //  wordlisttableviewcontroller.h //  vocabulous // //  created user30357 on 6/19/15. //  copyright (c) 2015 user30357. rights reserved. //  #import <uikit/uikit.h>  @interface wordlisttableviewcontroller : uiviewcontroller <uitableviewdelegate, uitableviewdatasource>{     nsmutabledictionary *words;     nsarray *sections; }  @end 

wordlisttableviewcontroller.m

// //  wordlisttableviewcontroller.m //  vocabulous // //  created user30357 on 6/19/15. //  copyright (c) 2015 user30357. rights reserved. //  #import "wordlisttableviewcontroller.h"  @interface wordlisttableviewcontroller () @property (nonatomic, retain) nsmutabledictionary *words; @property (nonatomic, retain) nsarray *sections; @end  @implementation wordlisttableviewcontroller  @synthesize words, sections;  - (nsmutabledictionary *) words{     if(!words){         nsurl *wordsurl = [nsurl urlwithstring:@"http://cs193p.stanford.edu/vocabwords.txt"];         words = [[nsmutabledictionary dictionarywithcontentsofurl:wordsurl] retain];     }     return words; }  - (nsarray *) sections{     if(!sections){         sections = [[[self.words allkeys] sortedarrayusingselector:@selector(compare:)] retain];     }     return sections; }  - (void)viewdidload {     [super viewdidload];      // uncomment following line preserve selection between presentations.     // self.clearsselectiononviewwillappear = no;      // uncomment following line display edit button in navigation bar view controller.     // self.navigationitem.rightbarbuttonitem = self.editbuttonitem; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  - (void)dealloc{     [words release];     [sections release];     [super dealloc]; }  #pragma mark - table view data source  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     // return number of sections.     return self.sections.count; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     // return number of rows in section.     nsarray *wordsinsection = [self.words objectforkey:[self.sections objectatindex:section]];     return wordsinsection.count; }  - (nsstring *) wordatindexpath:(nsindexpath *) indexpath{     nsarray *wordsinsection = [self.words objectforkey:[self.sections objectatindex:indexpath.section]];     return [wordsinsection objectatindex:indexpath.row]; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     nsstring *identifier = @"wordlisttableviewcell";     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:identifier];      if(cell == nil)         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:identifier];      // configure cell...     cell.textlabel.text = [self wordatindexpath:indexpath];     cell.accessorytype = uitableviewcellaccessorydisclosureindicator;     return cell; }   /* // override support conditional editing of table view. - (bool)tableview:(uitableview *)tableview caneditrowatindexpath:(nsindexpath *)indexpath {     // return no if not want specified item editable.     return yes; } */  /* // override support editing table view. - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath {     if (editingstyle == uitableviewcelleditingstyledelete) {         // delete row data source         [tableview deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade];     } else if (editingstyle == uitableviewcelleditingstyleinsert) {         // create new instance of appropriate class, insert array, , add new row table view     }    } */  /* // override support rearranging table view. - (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)fromindexpath toindexpath:(nsindexpath *)toindexpath { } */  /* // override support conditional rearranging of table view. - (bool)tableview:(uitableview *)tableview canmoverowatindexpath:(nsindexpath *)indexpath {     // return no if not want item re-orderable.     return yes; } */  /* #pragma mark - navigation  // in storyboard-based application, want little preparation before navigation - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     // new view controller using [segue destinationviewcontroller].     // pass selected object new view controller. } */  @end 

appdelegate.h

// //  appdelegate.h //  vocabulous // //  created user30357 on 6/19/15. //  copyright (c) 2015 user30357. rights reserved. //  #import <uikit/uikit.h>  @interface appdelegate : uiresponder <uiapplicationdelegate>  @property (strong, nonatomic) uiwindow *window;   @end 

appdelegate.m

// //  appdelegate.m //  vocabulous // //  created user30357 on 6/19/15. //  copyright (c) 2015 user30357. rights reserved. //  #import "appdelegate.h" #import "wordlisttableviewcontroller.h" @interface appdelegate ()  @end  @implementation appdelegate  @synthesize window;   - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point customization after application launch.      wordlisttableviewcontroller *wltvc = [[wordlisttableviewcontroller alloc] init];     uinavigationcontroller *nav = [[uinavigationcontroller alloc] init];     [nav pushviewcontroller:wltvc animated:no];     [wltvc release];     [window addsubview:nav.view];     [window makekeyandvisible];     return yes; }  - (void)applicationwillresignactive:(uiapplication *)application {     // sent when application move active inactive state. can occur types of temporary interruptions (such incoming phone call or sms message) or when user quits application , begins transition background state.     // use method pause ongoing tasks, disable timers, , throttle down opengl es frame rates. games should use method pause game. }  - (void)applicationdidenterbackground:(uiapplication *)application {     // use method release shared resources, save user data, invalidate timers, , store enough application state information restore application current state in case terminated later.     // if application supports background execution, method called instead of applicationwillterminate: when user quits. }  - (void)applicationwillenterforeground:(uiapplication *)application {     // called part of transition background inactive state; here can undo many of changes made on entering background. }  - (void)applicationdidbecomeactive:(uiapplication *)application {     // restart tasks paused (or not yet started) while application inactive. if application in background, optionally refresh user interface. }  - (void)applicationwillterminate:(uiapplication *)application {     // called when application terminate. save data if appropriate. see applicationdidenterbackground:. }  @end 

those 4 have classes. furthermore, storyboard has class wordlisttableviewcontroller, since deleted viewcontroller.

hope can me situation, because i'm turn crazy!

thanks now!

you not initialize window. method launch project change it.

in appdelegate.h

@property (strong, nonatomic) uiwindow *window; @property (strong, nonatomic) uinavigationcontroller *navigator; 

and @synthesize them.

 - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {      self.window=[[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];      loginviewcontroller *controller=[[loginviewcontroller alloc] init];     navigator = [[uinavigationcontroller alloc] initwithrootviewcontroller:controller];     [self.window setrootviewcontroller:navigator];     [self.window makekeyandvisible];       // override point customization after application launch.     return yes; } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -