UITableViewController initWithStyle tableView is nil afterwards?

Hi,
I had a problem with the UITableViewController when initialized using the initWithStyle - Method.
I derived my own UITableViewController from the standard version:
*@interface PrefTableViewController : UITableViewController*
I've overwritten the <code>initWithStyle</code> - Method like is:
*// Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.*
*if (self = [super initWithStyle: style ]) {*
* self.tabBarItem = [[ UITabBarItem alloc ] initWithTitle: @"Prefs" image: nil tag: 2 ];*
*return self;*
In the debugger the tableView property is still nil - later I load a UITableView from a NIB-File and assign it to the tableView - Property , which works but according to the Apple - Documentation which states:
"+You create a custom subclass of UITableViewController for each table view that you want to manage. When you initialize the controller in initWithStyle:, you must specify the style of the table view (plain or grouped) that the controller is to manage. Because the initially created table view is without table dimensions (that is, number of sections and number of rows per section) or content, the table view’s data source and delegate—that is, the UITableViewController object itself—must provide the table dimensions, the cell content, and any desired configurations (as usual). You may override loadView or any other superclass method, but if you do be sure to invoke the superclass implementation of the method, usually as the first method call."+
The tableView - Property should be assigned to a valid UITableView - Instance created by the Framework. Did I missunderstand the documentation or is this a bug ?
I'm using iPhone SDK 3.0.
Any help is greatly appreciated.
Thanks,
Frank

Hi Frank -
I don't think you did anything contrary to the doc you quoted. I'll need to know some more about your nib(s) and maybe the code in your app delegate to find out what's happening.
You said the table view was loaded from a nib. Was the PrefTableViewController also loaded from that same nib? When you use a subclass of UITableViewController, a table view is created and connected to the controller's tableView ivar when the controller is created. Therefore you would normally either load both the controller and its view from a nib or create both in your code. There would seldom be a good reason to load the table view from a nib while creating the controller in code. So that's the first bit of confusion we need to clarify.
// Override initWithStyle: if you create the controller programmatically and want
// to perform customization that is not appropriate for viewDidLoad.
initWithStyle is only called if you create the controller in code. So it won't run if you loaded the controller from a nib. I think we need to find out how that controller was created, or if in fact, it was never created.
To sort this out, it would help to see the code that either creates or loads your controller, in addition to any code that loads the table view separately. For a small app with one table view, it's likely you would either create or load the controller in applicationDidFinishLaunching, so that may be the only method we need to look at. However if the controller is defined in MainWindow.xib, then it would load automatically at startup, so we'd need to look carefully at that xib. Let us know which Xcode template you used to start the project, how many xib files you have, and a description of the xib(s) that you either modified or added to the template.
- Ray

Similar Messages

  • SIGABRT error when choosing a row of a tableview

    Hello, I am creating an iPhone app and I keep getting a "SIGABRT" error. I have a tableview where I want a separate webpage pushed for each rows.
    Currently, what happens is that the table displays; however, when I pick a row it gives me a SIGABRT error. Please help.
    Here is my first view (table view) .h file:
    #import <UIKit/UIKit.h>
    @interface videoTableViewController : UITableViewController
        NSArray *videos;
    @property (strong, nonatomic) NSArray *videos;
    @end
    Here is my first view (table view) .m file:
    #import "videoTableViewController.h"
    #import "videoURLController.h"
    @interface videoTableViewController ()
    @end
    @implementation videoTableViewController
    @synthesize videos;
    - (id)initWithStyle:(UITableViewStyle)style
        self = [super initWithStyle:style];
        if (self) {
            // Custom initialization
        return self;
    - (void)viewDidLoad
        [super viewDidLoad];
        videos = [NSArray arrayWithObjects:@"Welcome", @"Hello", @"Goodbye", nil];
        // Uncomment the following line to preserve selection between presentations.
        // self.clearsSelectionOnViewWillAppear = NO;
        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    - (void)viewDidUnload
        [super viewDidUnload];
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    #pragma mark - Table view data source
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
        // Return the number of sections.
        return 1;
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
        // Return the number of rows in the section.
        return [self.videos count];
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        static NSString *CellIdentifier = @"videoCell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        // Configure the cell...
        NSUInteger row = [indexPath row];
        cell.textLabel.text = [videos objectAtIndex:row];
        if (row == 0)
            cell.detailTextLabel.text = @"Welcome";
        if (row == 1)
            cell.detailTextLabel.text = @"What we value";
        if (row == 2)
            cell.detailTextLabel.text = @"What does Honor mean?";
        return cell;
    // Override to support conditional editing of the table view.
    - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
        // Return NO if you do not want the specified item to be editable.
        return YES;
    // Override to support editing the table view.
    - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
        if (editingStyle == UITableViewCellEditingStyleDelete) {
            // Delete the row from the data source
            [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
        else if (editingStyle == UITableViewCellEditingStyleInsert) {
            // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    // Override to support rearranging the table view.
    - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
    // Override to support conditional rearranging of the table view.
    - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
        // Return NO if you do not want the item to be re-orderable.
        return YES;
    #pragma mark - Table view delegate
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
         videoURLController *detailViewController = [[videoURLController alloc] initWithNibName:@"videoTableViewController" bundle:nil];
        UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
        if (indexPath.row == 0){
            [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
         // Pass the selected object to the new view controller.
         [self.navigationController pushViewController:detailViewController animated:YES];
    @end
    Here is my videoURLController (second view/web view) .h file?
    #import <UIKit/UIKit.h>
    @interface videoURLController : UIViewController
    @property (strong, nonatomic) IBOutlet UIWebView *webView;
    @end
    Here is my videoURLController (second view/web view) .m file?
    #import "videoURLController.h"
    @interface videoURLController ()
    @end
    @implementation videoURLController
    @synthesize webView;
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        return self;
    - (void)viewDidLoad
        [super viewDidLoad];
      // Do any additional setup after loading the view.
    - (void)viewDidUnload
        [super viewDidUnload];
        // Release any retained subviews of the main view.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    @end

    Hello, I am creating an iPhone app and I keep getting a "SIGABRT" error. I have a tableview where I want a separate webpage pushed for each rows.
    Currently, what happens is that the table displays; however, when I pick a row it gives me a SIGABRT error. Please help.
    Here is my first view (table view) .h file:
    #import <UIKit/UIKit.h>
    @interface videoTableViewController : UITableViewController
        NSArray *videos;
    @property (strong, nonatomic) NSArray *videos;
    @end
    Here is my first view (table view) .m file:
    #import "videoTableViewController.h"
    #import "videoURLController.h"
    @interface videoTableViewController ()
    @end
    @implementation videoTableViewController
    @synthesize videos;
    - (id)initWithStyle:(UITableViewStyle)style
        self = [super initWithStyle:style];
        if (self) {
            // Custom initialization
        return self;
    - (void)viewDidLoad
        [super viewDidLoad];
        videos = [NSArray arrayWithObjects:@"Welcome", @"Hello", @"Goodbye", nil];
        // Uncomment the following line to preserve selection between presentations.
        // self.clearsSelectionOnViewWillAppear = NO;
        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    - (void)viewDidUnload
        [super viewDidUnload];
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    #pragma mark - Table view data source
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
        // Return the number of sections.
        return 1;
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
        // Return the number of rows in the section.
        return [self.videos count];
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        static NSString *CellIdentifier = @"videoCell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        // Configure the cell...
        NSUInteger row = [indexPath row];
        cell.textLabel.text = [videos objectAtIndex:row];
        if (row == 0)
            cell.detailTextLabel.text = @"Welcome";
        if (row == 1)
            cell.detailTextLabel.text = @"What we value";
        if (row == 2)
            cell.detailTextLabel.text = @"What does Honor mean?";
        return cell;
    // Override to support conditional editing of the table view.
    - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
        // Return NO if you do not want the specified item to be editable.
        return YES;
    // Override to support editing the table view.
    - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
        if (editingStyle == UITableViewCellEditingStyleDelete) {
            // Delete the row from the data source
            [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
        else if (editingStyle == UITableViewCellEditingStyleInsert) {
            // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    // Override to support rearranging the table view.
    - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
    // Override to support conditional rearranging of the table view.
    - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
        // Return NO if you do not want the item to be re-orderable.
        return YES;
    #pragma mark - Table view delegate
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
         videoURLController *detailViewController = [[videoURLController alloc] initWithNibName:@"videoTableViewController" bundle:nil];
        UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
        if (indexPath.row == 0){
            [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
         // Pass the selected object to the new view controller.
         [self.navigationController pushViewController:detailViewController animated:YES];
    @end
    Here is my videoURLController (second view/web view) .h file?
    #import <UIKit/UIKit.h>
    @interface videoURLController : UIViewController
    @property (strong, nonatomic) IBOutlet UIWebView *webView;
    @end
    Here is my videoURLController (second view/web view) .m file?
    #import "videoURLController.h"
    @interface videoURLController ()
    @end
    @implementation videoURLController
    @synthesize webView;
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        return self;
    - (void)viewDidLoad
        [super viewDidLoad];
      // Do any additional setup after loading the view.
    - (void)viewDidUnload
        [super viewDidUnload];
        // Release any retained subviews of the main view.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    @end

  • Problems loading text to xib using plist in tableview's selected cell

    I am developing an app that starts with a grouped tableview cell.  Each cell has an image, text, and description from a plist.  When a cell is chosen a xib is loaded by a view controller in the plist.  I want to load into the xib some text, an image, and a sound file that is in the plist (dict for that cell).  This way I don't have to have lots of view controllers and xibs.  I have been able to load the xib using this method but I can't get the images and text to load.  I have been able to do it when I don't have a grouped table view but when I add the grouping in the plist the connection is lost.  below is my code.  Could someone look at it and tell me where I've gone wrong, how to correct it, or another way to do what I want to do?
    I know I am not calling the right array and then dictionary but I don't know how to correct this.  Help please.
    //  RootViewController.h
    //  TableViewPush
    #import <UIKit/UIKit.h>
    @interface RootViewController :  UITableViewController <UITableViewDelegate, UITableViewDataSource>  {
    NSArray *tableDataSm;
    @property (nonatomic, retain) NSArray *tableDataSm;
    @end
    //  RootViewController.m
    //  TableViewPush
    #import "RootViewController.h"
    #import "Location One.h"
    #import "HowToUseViewController.h"
    #import "TableViewPushAppDelegate.h"
    @implementation RootViewController
    @synthesize tableDataSm;
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        const NSDictionary *const row = [self rowForIndexPath:indexPath];
        NSString *wantedClassName = [row objectForKey:@"controller"];
        UIViewController *const vc = [[NSClassFromString (wantedClassName) alloc] init];
        NSLog(@"controller is -%@-", wantedClassName);
        [self.navigationController pushViewController:vc animated:YES];
        TableViewPushAppDelegate *appDelegate = ( TableViewPushAppDelegate *)[[UIApplication sharedApplication]delegate];
        appDelegate.myImage = [[NSString alloc]initWithFormat:@"%@",[[tableDataSm objectAtIndex:indexPath.row]objectForKey:@"picture"]];
    NSLog(@"%@", appDelegate.myImage);
    appDelegate.textView = [[NSString alloc]initWithFormat:@"%@",[[tableDataSm objectAtIndex:indexPath.row]objectForKey:@"description"]];
        [vc release];
    //  TableViewPushAppDelegate.h
    //  TableViewPush
    #import <UIKit/UIKit.h>
    @class RootViewController, HowToUseViewController;
    @interface TableViewPushAppDelegate : UIViewController <UIApplicationDelegate>  {
        NSString *myImage;
        NSString *textView;
        UIWindow *window;
        UINavigationController *navigationController;
        HowToUseViewController *howToUseViewController;
    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @property (nonatomic, retain) IBOutlet RootViewController *viewController;
    @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
    @property(retain,nonatomic)NSString *myImage;
    @property(retain,nonatomic)NSString *textView;
    @end
    //  TableViewPushAppDelegate.m
    //  TableViewPush
    #import "TableViewPushAppDelegate.h"
    #import "RootViewController.h"
    @implementation TableViewPushAppDelegate
    @synthesize window;
    @synthesize navigationController;
    @synthesize viewController;
    @synthesize myImage;
    @synthesize textView;
    //  Location One.h
    //  TableViewPush
    #import <UIKit/UIKit.h>
    #import "RootViewController.h"
    @interface   Location_One: UIViewController  {
        IBOutlet UIImageView *imageOne;
    IBOutlet UITextView  *textViewTwo;
    @property (nonatomic, retain) UITextView *textViewTwo;
    @property (nonatomic, retain) UIImageView *imageOne;
    @end
    //  Location One.m
    //  TableViewPush
    #import "Location One.h"
    #import "TableViewPushAppDelegate.h"
    @implementation Location_One
    @synthesize textViewTwo;
    @synthesize imageOne;
    -(id) init{
        if((self = [super initWithNibName:@"Location One" bundle:nil])){
        return self;
    - (void)viewDidLoad {
           NSLog(@"InView did load");
    [super viewDidLoad];
        TableViewPushAppDelegate *appDelegate = (TableViewPushAppDelegate *)[[UIApplication sharedApplication]delegate];
    textViewTwo.text = [[NSString alloc] initWithFormat:@"%@", appDelegate.textView];
    NSString *path = [[NSString alloc]initWithFormat:@"%@",appDelegate.myImage];
    UIImage *img = [UIImage imageNamed:path];
        [imageOne setImage:img];
    plist 
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
         <dict>
              <key>header</key>
              <string>85710</string>
              <key>rows</key>
              <array>
                   <dict>
                        <key>text</key>
                        <string>52 Glass Illusions Studio</string>
                        <key>detailText</key>
                        <string>150 S Camino Seco, #119</string>
                        <key>image</key>
                        <string>VisualFEight.png</string>
                        <key>controller</key>
                        <string>Location_One</string>
                        <key>picture</key>
                        <string>VisualOne.png</string>
                        <key>audio</key>
                        <string>AudioOne.mp3</string>
                        <key>description</key>
                        <string>TextOne</string>
                   </dict>

    I think you problem lies in this part.
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath {
        const NSDictionary *const row = [self rowForIndexPath:indexPath];
        NSString *wantedClassName = [row objectForKey:@"controller"];
        UIViewController *const vc = [[NSClassFromString (wantedClassName) alloc] init];
        NSLog(@"controller is -%@-", wantedClassName);
        [self.navigationController pushViewController:vc animated:YES];
        TableViewPushAppDelegate *appDelegate = ( TableViewPushAppDelegate *)[[UIApplication sharedApplication]delegate];
        appDelegate.myImage = [[NSString alloc]initWithFormat:@"%@",[[tableDataSmobjectAtIndex:indexPath.row]objectForKey:@"picture"]];
    NSLog(@"%@", appDelegate.myImage);
    appDelegate.textView = [[NSString alloc]initWithFormat:@"%@",[[tableDataSm objectAtIndex:indexPath.row]objectForKey:@"description"]];
        [vc release];
    specifically the underlined part.  does this need modifying or completely rewritten.

  • Loading custom TableView cell asynchronously

    hey all.i have custom cell which has a label and an image in it..i load the images synchronously the tableView but when i scroll down it frozen..so i want to load it asynchronously..to do that i read some tutorials and i found that site http://www.markj.net/iphone-asynchronous-table-image/ and import that files into my project but i cant use it..i wrote like that
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
              static NSString *CellIdentifier = @"Cell";
              Cell *cell =(Cell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
              if (cell == nil)
                        [[NSBundle mainBundle] loadNibNamed:@"Cell" owner:self options:nil];
                        cell=satir;
      else
      asyncImageview* oldImage = (asyncImageview*)
                        [cell.contentView viewWithTag:999];
                        [oldImage removeFromSuperview];
              CGRect frame;
              frame.size.width=75;
              frame.size.height=75;
              frame.origin.x=0;
              frame.origin.y=0;
              asyncImageview* asyncImage = [[[asyncImageview alloc] initWithFrame:frame] autorelease];
              NSURL* url = [thumb objectAtIndex:indexPath.row];
              [asyncImage loadImageFromURL:url];
      NSLog(@"url : %@",url);
              [cell.contentView addSubview:asyncImage];
        return cell;
    but i se nothing here..what is wrong there or what can  do to load images asynchronously

    thanks for the reply..i tried like in that example before..my app is like that
    @interface FirstViewController : UIViewController
    when i change it like UITableViewController the application crashed suddenly..why is that ?

  • TableView doesn't scroll after using pushviewcontroller

    have tabbarcontroller application. In which on first tab itself I have table view. I haven't added anything to NIB file. I have just created subclass of UITableViewController. My cells are custom. It does show the table with proper values.
    But on didSelectRow: method, I have called pushViewController. Once I press back from pushViewController and come back to original screen and start scrolling, my application terminates.
    Can anyone please help me out for this?
    //Code
    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    static NSString *CellIdentifier = @"Cell";
    CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    cell = [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    // Configure the cell...
    NSString *TitleValue = [listOfTitles objectAtIndex:indexPath.row];
    cell.primaryLabel.text = TitleValue;
    NSString *DateValue = [listOfDates objectAtIndex:indexPath.row];
    cell.secondaryLabel.text = DateValue;
    NSString *descValue=[listOfDesc objectAtIndex:indexPath.row];
    cell.thirdlabel.text = descValue;
    if([unreadFlag objectAtIndex:indexPath.row] == @"0")
    cell.primaryLabel.font = [UIFont boldSystemFontOfSize:15.0];
    else {
    cell.primaryLabel.font = [UIFont systemFontOfSize:15.0];
    return cell;
    //[CustomCell release];
    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    return 105;
    #pragma mark -
    #pragma mark Table view delegate
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    CustomCell *testcell = [tableView cellForRowAtIndexPath:indexPath];
    testcell.primaryLabel.font = [UIFont systemFontOfSize:15.0];
    [unreadFlag replaceObjectAtIndex:indexPath.row withObject:@"1"];
    selectedNS = [listOfIds objectAtIndex:indexPath.row];
    //Initialize the detail view controller and display it.
    DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
    dvController.selectedNS=selectedNS;
    [self.navigationController pushViewController:dvController animated:NO];
    [dvController release];
    dvController = nil;
    testcell.primaryLabel.font = [UIFont systemFontOfSize:15.0];
    [testcell release];
    - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
    //return UITableViewCellAccessoryDetailDisclosureButton;
    return UITableViewCellAccessoryDisclosureIndicator;
    - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
    [self tableView:tableView didSelectRowAtIndexPath:indexPath];
    Thank you,
    Ankita

    Hi: That happened to me too on my HP 350 G1. On mine, I went into the control panel, and I changed the view to Large Icons (because it is easier for me to find stuff that way). Then I found a Synaptics Luxpad control panel icon. I clicked on that and found that the scrolling feature was unchecked. I checked it, hit apply and close and now I can scroll again.

  • Crashed when call [tableView reloadData]

    Hi guys.
    I am facing with problem related UITableView. Below report has been displayed on the console.
    GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
    Attaching to process 2706.
    kill
    error while killing target (killing anyway): warning: error on line 1987 of "/SourceCache/gdb/gdb-966/src/gdb/macosx/macosx-nat-inferior.c" in function "macosxkill_inferiorsafe": (os/kern) failure (0x5x)
    Current language: auto; currently objective-c
    quit
    The Debugger has exited with status 0.(gdb)
    In MyViewController.h
    @interface MyViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
    IBOutlet UITableView *uiTableView;
    NSMutableArray *tableData;
    @property (nonatomic, retain) NSMutableArray *tableData;
    @property (nonatomic, retain) UITableView *uiTableView;
    @end
    In MyViewController.m
    - (void)viewDidLoad {
    tableData = [[NSMutableArray alloc] init];
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
    return 1;
    - (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
    return [tableData count];
    - (UITableViewCell *)tableView:(UITableView *)tableView
    cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
    reuseIdentifier:CellIdentifier] autorelease];
    NSUInteger row = indexPath.row;
    NSString *text = [[NSString alloc] initWithFormat@"%@", [tableData objectAtIndex:row]];
    cell.textLabel.text = text;
    [text release];
    return cell;
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    @end
    in MyConnection.m // This is implementation of NSURLConnection
    - (void)addTextInArray
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    [self performSelectorOnMainThread:@selector(addRow) withObject:nil waitUntilDone:YES];
    [pool release];
    - (void)addRow
    [tableController.tableData addObject:@"text in row"];
    - (void) updateTable {
    [tableController.uiTableView reloadData];
    After all texts has been added, application calls updateTable.
    At this moment, application crashed. In order word,
    - (UITableViewCell *)tableView:(UITableView *)tableView
    cellForRowAtIndexPath:(NSIndexPath *)indexPath
    It crashed in above method.
    Please help me guys,
    What is wrong me ?
    Thanks in advance.

    Thank you. Ray.
    First,
    NSLog(@"updateTable: isMainThread=%d", [NSThread isMainThread]);
    in console:
    2009-11-18 18:37:23.440 MyApplication[5412:20b] updateTable: isMainThread=1
    2009-11-18 18:37:23.445 MyApplication[5412:20b] updateTable: isMainThread=1
    2009-11-18 18:37:23.446 MyApplication[5412:20b] updateTable: isMainThread=1
    NSLog(@"cellForRow: isMainThread=%d", [NSThread isMainThread]); // add
    NSLog(@"--> tableData.count=%d row=%d", [_courseDetailList count], indexPath.row); // add
    2009-11-18 18:37:23.450 MyApplication[5412:20b] cellForRow: isMainThread=1
    2009-11-18 18:37:23.450 MyApplication[5412:20b] --> tableData.count=3 row=0
    2009-11-18 18:37:23.453 MyApplication[5412:20b] cellForRow: isMainThread=1
    2009-11-18 18:37:23.453 MyApplication[5412:20b] --> tableData.count=3 row=1
    2009-11-18 18:37:23.454 MyApplication[5412:20b] cellForRow: isMainThread=1
    2009-11-18 18:37:23.454 MyApplication[5412:20b] --> tableData.count=3 row=2
    GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
    Attaching to process 5412.
    kill
    error while killing target (killing anyway): warning: error on line 1987 of "/SourceCache/gdb/gdb-966/src/gdb/macosx/macosx-nat-inferior.c" in function "macosxkill_inferiorsafe": (os/kern) failure (0x5x)
    quit
    The Debugger has exited with status 0.(gdb)
    *Second, I've post the code below*
    My application is navigation based application. It connects with the server, then it downloads data and displays it as table.
    //MyApplicationAppDelegate.h
    #import <UIKit/UIKit.h>
    #import "MyNSURLConnection.h"
    @interface MyApplicationAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    UINavigationController *navigationController;
    MyNSURLConnection *connectionObject;
    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
    @property (nonatomic, retain) MyNSURLConnection *connectionObject;
    - (void)displayTableView;
    - (void)setConnURL:(NSString *)url;
    - (void)startURLRequest;
    + (MyApplicationAppDelegate *)sharedAppDelegate;
    @end
    //MyApplicationAppDelegate.m
    #import "MyApplicationAppDelegate.h"
    #import "RootViewController.h"
    #import "MyViewController.h"
    @implementation MyApplicationAppDelegate
    @synthesize window;
    @synthesize navigationController;
    @synthesize connectionObject;
    #pragma mark -
    #pragma mark Application lifecycle
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Override point for customization after app launch
    navigationController.toolbarHidden = NO;
    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
    [navigationController setToolbarHidden:YES animated:NO];
    [navigationController setNavigationBarHidden:YES animated:NO];
    connectionObject = [[MyNSURLConnection alloc] init];
    [self displayTableView];
    - (void)applicationWillTerminate:(UIApplication *)application {
    // Save data if appropriate
    - (void)displayTableView
    MyViewController *tableController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
    [self.connectionObject setTableController:tableController];
    [navigationController pushViewController:tableController animated:NO];
    [tableController release];
    NSLog(@"stack=%@", navigationController.viewControllers);
    - (void)setConnURL:(NSString *)url
    [connectionObject setUrl:url];
    - (void)startURLRequest
    [connectionObject startConnection];
    + (MyApplicationAppDelegate *)sharedAppDelegate
    return (MyApplicationAppDelegate *)[UIApplication sharedApplication].delegate;
    #pragma mark -
    #pragma mark Memory management
    - (void)dealloc {
    [navigationController release];
    [window release];
    [super dealloc];
    @end
    // MyNSURLConnection.h
    #import <Foundation/Foundation.h>
    @interface MyNSURLConnection : NSObject {
    NSString *url;
    UIViewController *tableController;
    @property (nonatomic, retain) NSString *url;
    @property (nonatomic, retain) UIViewController *tableController;
    - (void)startConnection;
    - (void)setTableController:(UIViewController *)controller;
    - (UIViewController*)getTableController;
    - (void)setRequest:(NSString *)openUrl;
    @end
    //MyNSURLConnection.m
    #import "MyNSURLConnection.h"
    #import "MyViewController.h"
    @implementation MyNSURLConnection
    @synthesize url;
    @synthesize tableController;
    - (void)startConnection
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.url]
    cachePolicy:NSURLRequestUseProtocolCachePolicy
    timeoutInterval:45];
    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    if(!theConnection) {
    NSLog(@"Connection failed.");
    - (void)setTableController:(UIViewController *)controller
    if(tableController != controller) {
    [tableController release];
    tableController = [controller retain];
    - (UIViewController*)getTableController
    return [[tableController retain] autorelease];
    - (void)setRequest:(NSString *)openUrl
    if(url != openUrl) {
    [url release];
    url = [openUrl retain];
    - (void)connection:(NSURLConnection *)theConnection didReceiveResponse:(NSURLResponse *)response
    NSLog(@"Response.");
    - (void)connection:(NSURLConnection *)theConnection didReceiveData:(NSData *)data
    NSMutableString *string = [[NSMutableString alloc] init];
    NSString *asData = [[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSASCIIStringEncoding];
    MyViewController *controller = (MyViewController *)tableController;
    NSLog(@"Data: %@", asData);
    for(int i = 0; i < [asData length] - 10; i= i+10) {
    for(int j = i; j < i + 10; j ++) {
    [string appendFormat:@"%c", [asData characterAtIndex:j]];
    [controller addRow:[[NSString alloc] initWithString:string]];
    [string setString:@""];
    [asData release];
    [string release];
    [controller.uiTableView reloadData];
    - (void)connection:(NSURLConnection *)connection
    didFailWithError:(NSError *)error
    - (void)connectionDidFinishLoading:(NSURLConnection *)connection
    @end
    //MyViewController.h
    #import <UIKit/UIKit.h>
    @interface MyViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
    IBOutlet UITableView *uiTableView;
    NSMutableArray *tableData;
    @property (nonatomic, retain) NSMutableArray *tableData;
    @property (nonatomic, retain) UITableView *uiTableView;
    - (void)addRow:(NSString *)text;
    @end
    // MyViewController.m
    #import "MyViewController.h"
    #import "MyApplicationAppDelegate.h"
    @implementation MyViewController
    @synthesize uiTableView;
    @synthesize tableData;
    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad {
    [super viewDidLoad];
    tableData = [[NSMutableArray alloc] init];
    - (void)viewWillAppear:(BOOL)animated
    [[MyApplicationAppDelegate sharedAppDelegate] setConnURL:@"http://www.google.com"];
    [[MyApplicationAppDelegate sharedAppDelegate] startURLRequest];
    - (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
    - (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
    // Number of sections is the number of regions
    return 1;
    - (void)addRow:(NSString *)text
    [tableData addObject:text];
    - (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
    return [tableData count];
    - (UITableViewCell *)tableView:(UITableView *)tableView
    cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"cellForRow: isMainThread=%d", [NSThread isMainThread]); // add
    NSLog(@"--> tableData.count=%d row=%d", [tableData count], indexPath.row); // add
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
    reuseIdentifier:CellIdentifier] autorelease];
    NSUInteger row = indexPath.row;
    NSString *text = [[NSString alloc] initWithFormat:@"%@", [tableData objectAtIndex:row]];
    cell.textLabel.text = text;
    [text release];
    return cell;
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"Selected row: %d", indexPath.row);
    - (void)dealloc {
    [super dealloc];
    @end
    Thanks in advance.

  • Tableview custom cell problem

    Hi everyone.
    I created a iOS tabbed application using xcode 4.2 and storyboard. I added one tableviewcontroller with custom cell on it, when clicking the row, I want to open one tableviewcontroller, i used the following code below
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        categoryClass *cc = [datas objectAtIndex:indexPath.row];
        [tableView deselectRowAtIndexPath:indexPath animated:NO];
        iSubProducts *subProducts = [[iSubProducts alloc] init];
        subProducts.title = cc.categoryName;
        subProducts.catID = cc.categoryID;
        [[self navigationController] pushViewController:subProducts animated:YES];
        [subProducts release];
    but when I click the row it gives me the following error:
    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath
    on my iSubProducts tableviewcontroller, i have the following:
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        static NSString *CellIdentifier = @"myCell2";
        iSubProductsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        productSubClass *cc = [datas2 objectAtIndex:indexPath.row];
        NSLog(@"Product Name: %@", cc.productName);
        cell.txtProductName.text  = cc.productName;
        cell.txtProductDesc.text = cc.productDesc;
        return cell;
    I assume this is where the error occurs, the cell is returning a nil value. When I try to attach the iSubProducts tableviewcontroller using or from a button, it all works fine, but if its coming from row clicked, this error shows up.
    Im quite new with iOS development, and maybe there is a error opening tableviewcontroller from a tableviewcontroller with a custom cell on it. I've been bangin my head for 2 days now and googled a lot, unfortunately I didn't find any solution. I'm pretty sure there's no error on the iSubProducts tableviewcontroller since its working if i tried pushing it from a button. Please I need advice on this one, Im so stucked right now with this issue. Thank you everyone.

    Hi,
    you need to create a tableViewCell in case the dequeueReusableCell-call doesn't return one.
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        static NSString *CellIdentifier = @"myCell2";
        iSubProductsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil)
            cell = (iSubProductCell *)[[UITableViewCell alloc] init....
        productSubClass *cc = [datas2 objectAtIndex:indexPath.row];
        NSLog(@"Product Name: %@", cc.productName);
        cell.txtProductName.text  = cc.productName;
        cell.txtProductDesc.text = cc.productDesc;
        return cell;
    Dirk

  • IB 3.1 iPhone SDK - UITableViewController?

    When you drag an instance of UITableViewController out of the IB Library in the iPhone SDK, you get a view with a tableView in it.
    Now if you have an existing window and other objects in that window, including a tableView (that you are trying to add a controller for), how are you supposed to do it?
    Usually, controller objects in IB just appear at the top-level in your nib file and have properties to connect them to the view object (a tableView) and the model object (the content).
    What is this new thing where it opens a view with a tableView in it already?
    Anybody know? Do I have to start the whole window with this view and add other objects to it? It's not even in the window - it doesn't even have its own window.

    iPhone Dev Center
    Downloads
    Read me before downloading
    If you have updated your device to iPhone OS 3.1.3 with iTunes, you must install iPhone SDK 3.1.3 in order to continue with your development.
    *iPhone SDK 3.1.3*
    iPhone SDK 3.1.3 includes the Xcode IDE, iPhone simulator, and a suite of additional tools for developing applications for iPhone and iPod touch.
    _Posted: February 2, 2010_
    Leopard Build: 9M2809a
    Snow Leopard Build: 10M2003a
    *Leopard Downloads*
    iPhone SDK 3.1.3 with Xcode 3.1.4
    iPhone SDK 3.1.3 with Xcode 3.1.4 Readme
    *Snow Leopard Downloads*
    iPhone SDK 3.1.3 with Xcode 3.2.1
    iPhone SDK 3.1.3 with Xcode 3.2.1 Readme
    *Other Downloads*
    iPhone SDK Agreement
    iPhone Configuration Utility

  • Selected rows in tableview

    Hello,
    Using a tableview with table iterator, the user can select one or more lines and delete them by using a button.
    A server event is triggered then to delete the data on the database. But afterwards the tableview appears with the same row indexes selected. But I don't
    want to have any selected rows afterwards and I don't know
    in fact where this indexes are from, where they are kept.
    The selected rows come from table->data
    ->PREVSELECTEDROWINDEXTABLE to delete the selected rows.
    The deletion of this indextable afterwards does not help to get rid of the selected rows after the server event.
    <htmlb:tableView id                    = "<%= l_ref_wa-QSDS_I_R3QSC_FIELDS-fields %>"
                         table                 = "//g_page1model_view/QSDS_I_QS_INPUT_NR2"
                         headerVisible         = "FALSE"
                         footerVisible         = "FALSE"
                         design                = "alternating"
                         selectionMode         = "MULTISELECT"
                         iterator              = "<%= g_page1model_view->tv_iterator %>"
                         focus1stSelectedCell  = "FALSE"
                         tabIndexCell          = "FALSE"
                         tableLayout           = "FIXED"
                         keepSelectedRow       = "FALSE"
                         headerText            = "<%= l_ref_wa-header %>"
                         allRowsEditable       = "X" />
    Anyone could help me.
    kind regards.
    Carola

    Hi Carola,
    some months ago a cool dude in this forum posted this code =)
        cl_htmlb_manager=>check_tableview_all_rows(
        rowcount = table_event->ROWCOUNT
        request = request
        id = '<YOUR TABLEID>'
        keytable = table_event->PREVSELECTEDROWKEYTABLE
        check = '' ).
    I am using it to deselect my tables and it works without any problems, have fun.
    regards
    Thomas

  • TextfieldCell in Transparent Tableview, shows background app during editing

    Hi,
    With reference to the RoundTransparentWindow code of Apple Examples, I tried to make my tableview also transparent from the following code.
    - (void)setColumnHeaderOf:(id)identifier image:(NSImage*)image title:(NSString*)title
    NSTableColumn *column=[self tableColumnWithIdentifier:identifier];
    [[column headerCell] setCellAttribute:NSCellHasImageOnLeftOrBottom to:NSImageBelow];
    [[column headerCell] setImage:image];
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:title];
    NSMutableParagraphStyle * aParagraphStyle = [[[NSMutableParagraphStyle alloc] init] autorelease];
    [aParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
    [aParagraphStyle setAlignment:NSCenterTextAlignment];
    CGFloat dividingFactor = 255.0f;
    NSMutableDictionary * aTitleAttributes = [[[NSMutableDictionary alloc] initWithObjectsAndKeys:
    [NSFontfontWithName:CPFONTNAME size:[NSFont systemFontSize]], NSFontAttributeName,
    aParagraphStyle,NSParagraphStyleAttributeName,
    nil] autorelease];
    [aTitleAttributes setValue:[NSColor colorWithDeviceRed:(246/dividingFactor) green:(204/dividingFactor)blue:(37/dividingFactor) alpha:1.0f] forKey:NSForegroundColorAttributeName];
    [attributedString addAttributes:aTitleAttributes range:NSMakeRange(0, [attributedString length])];
    [[column headerCell] setAttributedStringValue:attributedString];
    [attributedString release];
    - (void)awakeFromNib
    NSLog(@"KBCustomTableView awakeFromNib");
    [[self enclosingScrollView] setDrawsBackground:NO];
    NSRect frameRect = [[self headerView] frame];
    [[self headerView] setFrameSize:NSMakeSize(frameRect.size.width, 30)];
    [self setColumnHeaderOf:@"Column1" image:[NSImage imageNamed:@"ColHdr1"] title:@"Column1"];
    [self setColumnHeaderOf:@"Column2" image:[NSImage imageNamed:@"ColHdr2"] title:@"Column2"];
    [self setColumnHeaderOf:@"Column3" image:[NSImage imageNamed:@"ColHdr3"] title:@"Column3"];
    - (void)drawBackgroundInClipRect:(NSRect)clipRect
    NSLog(@"KBCustomTableView drawBackgroundInClipRect");
    //[super drawBackgroundInClipRect:clipRect];
    - (id)_highlightColorForCell:(NSCell *)cell
    [self setBackgroundColor:[NSColor clearColor]];
    return nil;
    It works fine but with one strange behaviour of textfieldCell.
    WhileEditing the textfieldCell, my background app is shown clearly. This is because in the method, _highlightColorForCell self setBackgroundColor:[NSColor clearColor]]; If I don't do this, then my table behaves very much weird with lot of colors.
    Any idea how to resolve this.
    Regards
    symadept

    Hi again
    You can control the anti-aliasing on a global scale via Edit > Preferences.
    Slide color is controlled either at the slide level itself (examine Slide Properties) and you can also set a default color in Preferences so that if you click Insert > Blank Slide it has a defined color.
    It's common for folks to use the hot pink color as a transparent color. I just figured that you were configuring that color in the bitmap image you were creating for the caption. If you haven't done this, I'm unsure where the color may be coming from. Are you using a Bitmap Image in BMP format for the Caption? If not, perhaps you are using PNG or something like that and Captivate may be interpreting a transparent color set in the PNG. Not sure.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Best place for tableview scrollToRowAtIndexPath?

    Hi, wondering what the right place is to put a call to scroll a tableview to a specified section/row, but only when an app first starts up. I have a subclass of UITableViewController, and I load my data in viewDidLoad. Adding a call to scrollToRowAtIndexPath in viewDidLoad bombs (naturally). I added a boolean to the controller to track whether I need to scroll, and successfully added the scroll code into viewDidAppear, flipping the boolean to prevent it from happening again the app's lifespan...but is that the right place to put it? Seems a bit clunky.
    Here's the code:
    - (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    if (!started) {
    started = YES;
    NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:row inSection:section];
    [self.tableView scrollToRowAtIndexPath:scrollIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
    BTW, how do I post code so it looks good?
    Thanks!

    how about viewWillAppear?
    Put your code in Squiggly brackets starting and ending with { code } (no spaces)
    //code example

  • TableView FXML problems

    Hello,
    I'm currently trying to learn some FXML and have at least 4 problems with the TableView component:
    1) TableView shows some strange behavior after maximizing the window:
    https://dl.dropbox.com/u/1030857/maximized.PNG
    and minimizing it afterwards:
    https://dl.dropbox.com/u/1030857/normalaftermax.PNG
    When resizing (particularily making the window bigger) the unstyled table is visible too:
    https://dl.dropbox.com/u/1030857/resizing.PNG
    I set some some constraints on the columns and I am using the CONSTRAINED_RESIZE_POLICY and here is the FXML:
    <TableView fx:id="taskTable" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
                <placeholder><Label text="" /></placeholder>
                <columnResizePolicy><TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /></columnResizePolicy>
                <columns>
                    <TableColumn text="Completed" minWidth="75" prefWidth="75" maxWidth="75" >
                         <cellValueFactory><PropertyValueFactory property="completed" /></cellValueFactory>
                    </TableColumn>
                    <TableColumn text="Task">
                        <cellValueFactory><PropertyValueFactory property="name" /></cellValueFactory>
                    </TableColumn>
                    <TableColumn text="Progress" minWidth="100" prefWidth="100" maxWidth="100">
                        <cellValueFactory><PropertyValueFactory property="progress" /></cellValueFactory>
                    </TableColumn>
                </columns>
                <items>
                    <FXCollections fx:factory="observableArrayList">
                        <Task completed="false" name="Random" progress="0" />
                        <Task completed="false" name="Srandom" progress="3" />
                        <Task completed="true" name="Andom" progress="5" />
                    </FXCollections>
                </items>
    </TableView>The TableView Control sits in a VBox which sits in the center of a BorderPane.
    2) I have found some code to hide the table header:
    Pane header = (Pane) table.lookup("TableHeaderRow");
    header.setVisible(false);
    table.setLayoutY(-header.getHeight());
    table.autosize();but I don't know where I can call it. I have a controller for the Main Window and if I use the Initializable interface I obviously get NullPointerException, because the TableView isn't created yet.
    3) Is it possible to remove the resize lines / column borders? I tried changing CSS of the column-resize-line substructure of the TableView, but with no success...
    4) I haven't found anything reliable on the net: How can I set a Checkbox Cell Factory in the table using FXML? I did it earlier using DataFX cell factories, but only in pure Java.
    Kind regards,
    Daniel

    i solved this problem by creating a CustomTableView which extends from TableView and setting columnResizePolicy="CONSTRAINED_RESIZE_POLICY" in constructor.

  • TableView is shifted up under status bar?

    Ok, simple newbie question.
    I tried searching, but either get results which have nothing to do with the issue, or nothing.
    So, here goes....
    I created new TableViewController, and added a search bar to the top in InterfaceBuilder/XCode 4.2.
    Now when my tableView displays, the view starts out hidden by the status bar at the top of the screen, and doesn't cover the bottom 20 pixels which is the height of the status bar.  It obviously know how big it should be, but is shifted 20 pixels.
    Anyone can tell me why, and how to fix it?
    Thanks.
    Code is right out of Mark & LaMarche

    Ok, maybe not enough info....
    Basic, brand-new UITableViewController, using Add file in XCode...
    Drag SearchBar to top of UITableView item.
    Add rest of code.... and run...
    And... it's obvious that the view is the correct size, as it knows that there is a status bar, because when I invoke this screen later in the program, the bottom of the tabbar buttons show below the end of the view.  If it simply started 20 pixels down, or 40 on the retina-display, then all would be fine.
    Looking over the size controls, or anything else, there's nothing that lets be graphically set the view origin as it seems to be set at 0,0.
    It must be something very simple, and I've fixed this before in other projects.  Just don't remember what needs to be fixed.
    Thanks.

  • Question abt using 2 tableview

    Hi, I 'm a iphone programming newbie. I m trying to implement an app with multi-level tableviews.
    The idea is if someone selects something on the first screen say then a new view opens(tableview)
    Quote:
    car make> list of models
    Honda > Acura, S2000,accord ...
    My challenge is to show the list of models in a new tableview & secondly change the size of hte list depending on the car selected.
    I have programmed so that when i select 'Honda' a new tableview opens. How do i populate data for the second table??
    Any suggestions on how to proceed?

    Hi JB -
    jBourne08 wrote:
    I have programmed so that when i select 'Honda' a new tableview opens. How do i populate data for the second table??
    If you're comfortable with core data, that would probably offer the most general solution. But if not, I think plists will work just fine for what you described. If you're new to Cocoa, the plist solution is much easier to understand and maintain, so that's the approach I'll go over here.
    I'll assume you know what a property list is, but if you don't, instructive references are plentiful (see [Quick Start for Property Lists|https://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual /PropertyLists/QuickStartPlist/QuickStartPlist.html#//apple_ref/doc/uid/10000048 i-CH4-SW5] or [iPhone tutorial: Storing and retrieving information using plists|http://humblecoder.blogspot.com/2009/05/iphone-tutorial-storing-and-retr ieving.html]). For what you've described thus far, we just need to store arrays of dictionaries. The top level file will look something like this:
    /* cars.plist */
    Root (array)
    Item 1 (dictionary)
    Make (string) Honda
    Image (string) Honda.png
    etc.
    Item 2 (dictionary)
    Make (string) Ford
    Image (string) Ford.png
    etc.
    etc.
    Of course if you don't need anything in the dictionaries except for the Make, the above can be reduced to an array of strings instead of an array of dictionaries. But an array of dictionaries is a good choice if you think you might want something besides just the one string (e.g. a logo).
    Once you know how to make the first plist, the second level plists will be easy, e.g.:
    /* honda.plist */
    Root (array)
    Item 1 (dictionary)
    Model (string) Accord
    Mileage (number) 31
    Price (number) 21055
    Image (string) Accord.png
    etc.
    Item 2 (dictionary)
    Model (string) Civic
    Mileage (number) 34
    Price (number) 15455
    Image (string) Civic.png
    etc.
    etc.
    Now we just pass the name of the selected Make to the second-level controller, which (luckily!) has an instance variable for this very purpose. e.g.:
    // RootViewController.m (first table view delegate)
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // create the second level view controller
    SecondViewController *secondViewController = [[SecondViewController alloc]
    initWithNibName:@"SecondViewController" bundle:nil];
    // get the name of the selected Make
    NSDictionary *dict = [self.dataArray objectAtIndex:indexPath.row];
    NSString *selectedMake = [dict objectForKey:@"Make"];
    // pass the selected Make to the new view controller
    secondViewController.selectedMake = selectedMake;
    // push the second view controller onto the navigation stack
    [self.navigationController pushViewController:secondViewController animated:YES];
    // reduce the second view controller's retain count to 1
    [secondViewController release];
    When the secondViewController is pushed onto the stack it's view will load, and the controller will read the data it needs:
    // SecondViewController.m
    - (void)viewDidLoad {
    // obtain the correct data file pathname from the selectedMake
    NSString *pathName = [[NSBundle mainBundle]
    pathForResource:self.selectedMake ofType:@"plist"];
    // read the data file into the data source array
    self.dataArray = [NSArray arrayWithContentsOfFile:pathName];
    // display the data in the tableView
    [tableView reloadData];
    Note viewDidLoad in the root controller will look just like the above except the plist file name will be hardcoded (@"cars").
    Disclaimer: These example methods aren't tested and may have syntax errors or throw runtime exceptions. They're only intended to illustrate the basic idea. If you want to use this solution, but can't make the examples work, I'll be happy to clean them up for you.
    Hope that helps!
    - Ray

  • Loading a View Controller based on UITableViewController cell

    Hi,
    I've been trying to make my TableViewController cells load different UIViewControllers when they are clicked, but haven't been having any luck. All that happens is my program starts but then when I click on the cells, the view freezes. This is my code for just loading one view but this can easily be changed to load different views later:
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UIViewController *targetViewController = [menuList objectAtIndex: indexPath.row];
    if (targetViewController == nil) {
    switch(indexPath.row){
    case 0: {
    targetViewController = [[PageTitleViewController alloc] initWithNibName:@"PageTitleViewController" bundle:nil];
    break;
    case 1: {
    targetViewController = [[PageTitleViewController alloc] initWithNibName:@"PageTitleViewController" bundle:nil];
    break;
    case 2: {
    targetViewController = [[PageTitleViewController alloc] initWithNibName:@"PageTitleViewController" bundle:nil];
    break;
    case 3: {
    targetViewController = [[PageTitleViewController alloc] initWithNibName:@"PageTitleViewController" bundle:nil];
    break;
    targetViewController = [menuList objectAtIndex: indexPath.row];
    [[self navigationController] pushViewController:targetViewController animated:YES];
    is there a better way of doing this? I tried if(indexPath.row == 0) but that seemed to make it freeze as well!

    // MyTableController.h
    #import <UIKit/UIKit.h>
    #define kMenuLabelTag 100
    @interface MyTableController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
    IBOutlet UITableView *myTableView;
    NSArray *menuList;
    NSMutableArray *controlList;
    IBOutlet UINavigationController *navigationController;
    @property (nonatomic, retain) IBOutlet UITableView *myTableView;
    @property (nonatomic, copy) NSArray *menuList;
    @property (nonatomic, retain) NSMutableArray *controlList;
    @property (nonatomic, assign) IBOutlet UINavigationController *navigationController;
    @end
    // MyTableController.m
    #import "MyTableController.h"
    #import "PageTitleViewController.h"
    @implementation MyTableController
    @synthesize myTableView, menuList, controlList, navigationController;
    #pragma mark Table View Controller Methods
    // Implement viewDidLoad to do additional setup after loading the view.
    - (void)viewDidLoad {
    [super viewDidLoad];
    self.menuList = [NSArray arrayWithObjects:
    @"Start",
    @"Settings",
    @"Instructions",
    @"About",
    nil];
    NSMutableArray *mutableArray = [[NSMutableArray alloc] initWithCapacity:10];
    for (int i = 0; i < [menuList count]; i++)
    [mutableArray addObject:[NSNull null]];
    self.controlList = mutableArray;
    [mutableArray release];
    - (void)dealloc {
    [myTableView release];
    [menuList release];
    [controlList release];
    [super dealloc];
    #pragma mark -
    #pragma mark Table View Data Source Methods
    - (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.menuList count];
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *MyIdentifier = @"MyIdentifier";
    UITableViewCell *Start = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (Start == nil) {
    Start = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
    Start.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    UILabel *label = [[UILabel alloc] init];
    label.font = [UIFont boldSystemFontOfSize:24.0f];
    label.frame = CGRectMake(85.0f, 15.0f, 200.0f, 28.0f);
    label.textColor = [UIColor blackColor];
    label.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.6];
    label.opaque = NO;
    label.tag = kMenuLabelTag;
    [Start.contentView addSubview:label];
    [label release];
    UILabel *menuLabel = (UILabel*)[Start.contentView viewWithTag:kMenuLabelTag];
    menuLabel.text = [menuList objectAtIndex:indexPath.row];
    return Start;
    #pragma mark -
    #pragma mark Table View Delgate Methods
    - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath {
    NSUInteger row = [indexPath row];
    NSLog(@"entering didSelectRow: controlList=%@ row=%d", controlList, row);
    if ([controlList count] <= row) {
    NSLog(@"return - controlList too short");
    return;
    UIViewController *targetViewController = [controlList objectAtIndex:indexPath.row];
    if ((NSNull *)targetViewController == [NSNull null]) {
    NSLog(@"at switch: targetViewController=%@", targetViewController);
    switch(row){
    case 0: {
    targetViewController = [[PageTitleViewController alloc] initWithNibName:@"PageTitleViewController" bundle:nil];
    break;
    case 1: {
    targetViewController = [[PageTitleViewController alloc] initWithNibName:@"PageTitleViewController" bundle:nil];
    break;
    case 2: {
    targetViewController = [[PageTitleViewController alloc] initWithNibName:@"PageTitleViewController" bundle:nil];
    break;
    case 3: {
    targetViewController = [[PageTitleViewController alloc] initWithNibName:@"PageTitleViewController" bundle:nil];
    break;
    default: {
    NSLog(@"return - invalid row no.: %d", row);
    return;
    if (![targetViewController respondsToSelector:@selector(view)]) {
    NSLog(@"return after switch - targetViewController is not a controller");
    return;
    [controlList replaceObjectAtIndex:row withObject:targetViewController];
    [targetViewController release];
    NSLog(@"ready to push controller: controlList=%@ targetViewController=%@", controlList, targetViewController);
    [[self navigationController] pushViewController:targetViewController animated:YES];
    @end

Maybe you are looking for

  • "save optimized as" window in save for web shows desktop but not correct folder

    In "where", it shows desktop, with the icon of a folder, and not the name of the folder the picture is in, as is usual, if I cick on the pop down menu,{of the where field) at the bottom i am showing recent places in gray, and then the name of a folde

  • Mutt sidebar and imap gmail account: Segmentation fault

    Hi, i recently installed mutt sidebar, but i cannot get it to work. if i use "mailboxes =INBOX" it gives segmentation fault, with that line commented out, it works (except for no sidebar folders) i've tried with +INBOX, +Inbox, =Inbox, Inbox, INBOX,

  • Urgent Reqrd COPA Customization Material for 5.0 or 6.0

    HI GURU's i Urgently reqrd SAP COPA Customization Material for 5.0 or 6.0 please help me out to mail me at my personal mail id at [email protected] thanks and regards R

  • Type shift between design mode and preview mode in Muse.

    My type shifts / moves positions between design and preview modes. It then justifies differently in differnet Web Browsers. This mean I end up positioning things incorrectly in design mode to accommodate the error when published. I am using the Droid

  • Slideshow app

    I love keynote, it is so user friendly.  I am looking for an app as simple and user friendly as keynote, but that I can add music to.  I am trying to make a slide show, with text (photo description) with music in the back ground.  Any suggestions?