Issue Displaying/Hiding Views (Obj-C iPhone Programming)

Posted by roswell on Stack Overflow See other posts from Stack Overflow or by roswell
Published on 2010-04-04T23:59:12Z Indexed on 2010/04/05 0:03 UTC
Read the original article Hit count: 166

Filed under:
|

All right all,

So I've got a UITableView that is inited in applicationDidFinishLaunching like so: [self showForumList]; Said method does this:

-(void)showForumList {
    ForumList *fl = [ForumList alloc];
    [fl initWithNibName:@"ForumList" bundle:[NSBundle mainBundle]];
    self.ForumList = fl;
    [window addSubview:[self.ForumList view]];
    [fl release];
}
where self.ForumList is previously defined in the interface as ForumList *ForumList;, etc.

Now, in ForumList (itself an extension of UITableViewController obviously), I've got didSelectRowAtIndexPath: -- within it I have the following code:

   Forum *f = [Forum alloc];
    NSArray *forums = [f getForumList];

    NSDictionary *selectedForum = [forums objectAtIndex:[indexPath row]];

    NSString *Url = [selectedForum objectForKey:@"url"];
    NSString *Username = [selectedForum objectForKey:@"username"];
    NSString *Password = [selectedForum objectForKey:@"password"];

    NSLog(@"Identified press on forum %@ (%@/%@)", Url, Username, Password);

    [self.globalDelegate showForumListFromForumUsingUrl:Url username:Username password:Password];
    [self.globalDelegate closeForumList];
    NSLog(@"ForumListFromForum init");

Both of the NSLog calls in this function are executed and perform as they should. Now, here is where the issue starts.

self.globalDelegate is defined as AppDelegate *globalDelegate; in the Interface specification in my header file. However, [self.globalDelegate showForumListFromForumUsingUrl:username:password] and and [self.globalDelegate closeForumList] are never actually called. They look like so:

-(void)closeForumList {
    NSLog(@"Hiding forum list");
    [[self.ForumList view] removeFromSuperview];
}

-(void)showForumListFromForumUsingUrl:(NSString *)Url username:(NSString *)Username password:(NSString *)Password {
    NSLog(@"Showing forum list from forum");
    ForumListFromForum *fl = [ForumListFromForum alloc];

    [fl initWithNibName:@"ForumListFromForum" bundle:[NSBundle mainBundle]];
    [fl initFromForumWithUrl:Url username:Username password:Password];

    self.ForumListFromForum = fl;
    [window addSubview:[self.ForumListFromForum view]];
    [fl release];
}

The app does not respond to my press and neither of these NSLog calls are made.

Any idea where I've gone wrong?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about views