Results 1 to 2 of 2
Discuss [Dev] UITableView, if anyone can assist at the iPhone Developer Exchange - Hackint0sh.org; I am trying to get a table to load. As we all know, I can't ...
  1. #1
    Rookie Array

    Join Date
    Feb 2008
    Posts
    12
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Unhappy [Dev] UITableView, if anyone can assist

    I am trying to get a table to load. As we all know, I can't do it in IB - I've been making a basic interface in IB and then using (void)awakeFromNib to add elements to the interface that aren't part of IB. It sort-of works. I'm having two problems and would love some help, I've run into a wall for the past two days.

    I'm (fairly) new to objective-c and i've been looking at all of the sample UITableView code but none of the examples implement a table view from a separate UIViewController class or from an awakefromnib method, so I can't figure out how to do it. What I mean is that they all implement a table with AppDelegate and a rootViewController. When I try to implement a table view like the examples, my app crashes, I think because I have a tab bar as the root view controller so I can't initWithRootViewController. I *think* but don't know that that's why my app crashes when i follow the examples.


    I've been using this code in my awakeFromNib method in my view controller class that I'm trying to use:


    UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]
    style:UITableViewStylePlain];

    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.rowHeight = 54;
    [tableView reloadData];


    It either doesn't show up or crashes the app (if i put it in my appdelegate file).




    Anyway, can anyone explain how to implement a table in (void) awakeFromNib, or something similar, so i can add the table to the nib file through my code?

    Secondly, when I try to do the same thing with say, a UISwitch or Slider or Button they remain static (even though I am sure I have my views set to be user interactable), why would they not respond to my actions? Here's an example of the code I've used for the UISwitch:

    CGRect frame = CGRectMake(0, 0, 60, 26);
    UISwitch *switchControl = [[UISwitch alloc] initWithFrame:frame];
    [switchControl addTarget:self action:@selector(action forControlEvents:UIControlEventTouchUpInside];
    [switchControl setBackgroundColor:[UIColor clearColor]];
    [self.view addSubview: switchControl];


    I would LOVE some assistance, I have this great user interface and the elements of what will be a cool program but I need a table view and some extra controls like I need air to breathe and this is driving me insane. Thanks in advance.



  2. #2
    Rookie Array

    Join Date
    Apr 2008
    Posts
    18
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    I do not use nib, but if you want to see the code without the IB, let me know.

 

 

Similar Threads

  1. Navigation Controller Pointer for UITableView
    By computerartist in forum iPhone Developer Exchange
    Replies: 1
    Last Post: 10-06-2010, 04:57 PM
  2. help me regarding UITableView.
    By nat.iphone in forum iPhone Developer Exchange
    Replies: 0
    Last Post: 05-12-2010, 08:01 AM
  3. UITableView: Need a help
    By Neshta in forum iPhone Developer Exchange
    Replies: 0
    Last Post: 07-29-2008, 09:56 AM
  4. [Interface Builder] UITableView from Beta 4 still doesn't work ?
    By virus in forum iPhone Developer Exchange
    Replies: 2
    Last Post: 04-26-2008, 01:45 AM
  5. 10.5 tutorials problem please assist
    By -henky in forum Archiv (Leopard)
    Replies: 0
    Last Post: 10-27-2007, 11:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 01:43 AM.
twitter, follow us!