English 中文(简体)
可从电离室入电离层,并得出以下看法:
原标题:UITableView- tap into the cell and get the next view

I have problems entering a next view in the TableViewController. When I click on the cells i see the NSLog-text, but there is no action and no second view. This means the program enter the methods but does nothing. What is my fault? I am testing around without getting any solution.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    if (indexPath.row==0) {
        NSLog(@"Index 0");
        AudioViewController *audioviewcontroller = [[AudioViewController alloc] initWithNibName:@"AudioViewController" bundle:nil];
        [self.navController pushViewController:audioviewcontroller animated:YES];
        [audioviewcontroller release];
        [tableView deselectRowAtIndexPath: indexPath animated:YES];

    }
    if (indexPath.row==1) {
        NSLog(@"Index 1");
        DisplayViewController *displayviewcontroller = [[DisplayViewController alloc] initWithNibName:@"DisplayViewController" bundle:nil];
        [self.navController pushViewController:displayviewcontroller animated:YES];
        [displayviewcontroller release];
        [tableView deselectRowAtIndexPath: indexPath animated:YES];
    }
    if (indexPath.row==2) {
        LichtViewController *lichtviewcontroller = [[LichtViewController alloc] initWithNibName:@"LichtViewController" bundle:nil];
        [self.navController pushViewController:lichtViewController animated:YES];
        [lichtviewcontroller release];
        [tableView deselectRowAtIndexPath: indexPath animated:YES];
        NSLog(@"Index 2");
    }
    if (indexPath.row==3) {
        NSLog(@"Index 3");
        ProjektorViewController *projektorviewcontroller = [[ProjektorViewController alloc] initWithNibName:@"ProjektorViewController" bundle:nil];
        [self.navController pushViewController:projektorviewcontroller animated:YES];
        [tableView deselectRowAtIndexPath: indexPath animated:YES];
        [projektorviewcontroller release];

    }
}

而且 我研究了这一法典:

UIView *currentView = self.view;    
UIView *theWindow = [currentView superview];
[currentView removeFromSuperview];      
UIView* audioView= audioviewcontroller.view;        
[theWindow addSubview:audioView];       
[self.navController pushViewController:audioviewcontroller animated:YES];       [audioviewcontroller release];
[tableView deselectRowAtIndexPath: indexPath animated:YES]; 

我没有接到警告,只是一次坠毁,而且烟 con显示:

2011-10-26 10:01:59.344 subview[971:207] -[__NSCFTimer numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x4b44880
2011-10-26 10:01:59.346 subview[971:207] *** Terminating app due to uncaught exception  NSInvalidArgumentException , reason:  -[__NSCFTimer numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x4b44880 
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dcf5a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f23313 objc_exception_throw + 44
    2   CoreFoundation                      0x00dd10bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x00d40966 ___forwarding___ + 966
    4   CoreFoundation                      0x00d40522 _CF_forwarding_prep_0 + 50
    5   UIKit                               0x0047a6ff -[UITableViewRowData(UITableViewRowDataPrivate) _updateNumSections] + 111
    6   UIKit                               0x0047a3b0 -[UITableViewRowData invalidateAllSections] + 66
    7   UIKit                               0x00331d23 -[UITableView(_UITableViewPrivate) _updateRowData] + 113
    8   UIKit                               0x0032d65c -[UITableView noteNumberOfRowsChanged] + 105
    9   UIKit                               0x0033a708 -[UITableView reloadData] + 773
    10  UIKit                               0x00337844 -[UITableView layoutSubviews] + 42
    11  QuartzCore                          0x01d6fa5a -[CALayer layoutSublayers] + 181
    12  QuartzCore                          0x01d71ddc CALayerLayoutIfNeeded + 220
    13  QuartzCore                          0x01d170b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
    14  QuartzCore                          0x01d18294 _ZN2CA11Transaction6commitEv + 292
    15  QuartzCore                          0x01d1846d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
    16  CoreFoundation                      0x00db089b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
    17  CoreFoundation                      0x00d456e7 __CFRunLoopDoObservers + 295
    18  CoreFoundation                      0x00d0e1d7 __CFRunLoopRun + 1575
    19  CoreFoundation                      0x00d0d840 CFRunLoopRunSpecific + 208
    20  CoreFoundation                      0x00d0d761 CFRunLoopRunInMode + 97
    21  GraphicsServices                    0x017261c4 GSEventRunModal + 217
    22  GraphicsServices                    0x01726289 GSEventRun + 115
    23  UIKit                               0x002cdc93 UIApplicationMain + 1160
    24  subview                             0x000023b4 main + 102
    25  subview                             0x00002345 start + 53
    26  ???                                 0x00000001 0x0 + 1
)
terminate called after throwing an instance of  NSException 

感谢你事先提供帮助

最佳回答

如果为你工作的话,这就是我如何在表态中宣布我的物体/变量。 宣布你在职能顶端的标(观点)

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

 AudioViewController *audioviewcontroller = [[AudioViewController alloc] initWithNibName:@"AudioViewController" bundle:nil];
 DisplayViewController *displayviewcontroller = [[DisplayViewController alloc] initWithNibName:@"DisplayViewController" bundle:nil];
 LichtViewController *lichtviewcontroller = [[LichtViewController alloc] initWithNibName:@"LichtViewController" bundle:nil];
 ProjektorViewController *projektorviewcontroller = [[ProjektorViewController alloc] initWithNibName:@"ProjektorViewController" bundle:nil];

 if (indexPath.row==0) {
    NSLog(@"Index 0");
    [self.navController pushViewController:audioviewcontroller animated:YES];
    [audioviewcontroller release];
    [tableView deselectRowAtIndexPath: indexPath animated:YES];
 }
 if (indexPath.row==1) {
    NSLog(@"Index 1");
    [self.navController pushViewController:displayviewcontroller animated:YES];
    [displayviewcontroller release];
    [tableView deselectRowAtIndexPath: indexPath animated:YES];
 }
 if (indexPath.row==2) {
    [self.navController pushViewController:lichtViewController animated:YES];
    [lichtviewcontroller release];
    [tableView deselectRowAtIndexPath: indexPath animated:YES];
    NSLog(@"Index 2");
 }
 if (indexPath.row==3) {
    NSLog(@"Index 3");
    [self.navController pushViewController:projektorviewcontroller animated:YES];
    [tableView deselectRowAtIndexPath: indexPath animated:YES];
    [projektorviewcontroller release];

 }
}
问题回答

与观察控制器有关的导航控制员代理人是本身.navigation Controller,如果你把观察控制器推向该控制器,该代表是否无所作为?

您可以从观察控制器中设立导航控制员(见,请说明如何使用UINavigation 主计长here

根据你的错误,我认为存在问题。 如果你给出完整的表格代码,那么我想会发现问题。





相关问题
Asynchronous request to the server from background thread

I ve got the problem when I tried to do asynchronous requests to server from background thread. I ve never got results of those requests. Simple example which shows the problem: @protocol ...

objective-c: Calling a void function from another controller

i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

NSUndoManager and runModalForWindow:

I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...

NSMutableArray values becoming "invalid"

I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...

iPhone numberpad with decimal point

I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values ...

热门标签