2015-05-15 6 views
5

Sto tentando di impostare un WKInterfaceTable. Ho seguito i documenti di mele. La mia etichetta non riceve testo e ricevo questo messaggio di errore nella console:Impossibile specificare setter 'setTitle:' per le proprietà di NSObject o WKInterfaceController

Cannot specify setter 'setTitle:' for properties of NSObject or WKInterfaceController 

Come posso risolvere questo problema? Obiettivo-C per favore. Qui s il mio codice:

.h

#import <Foundation/Foundation.h> 
#import <WatchKit/WatchKit.h> 

@interface MainRowType : NSObject 

@property (strong, nonatomic) IBOutlet WKInterfaceImage *image; 
@property (strong, nonatomic) IBOutlet WKInterfaceLabel *title; 

@end 

.m

#import "MainRowType.h" 

@implementation MainRowType 


@end 

.h

#import <WatchKit/WatchKit.h> 
#import <Foundation/Foundation.h> 
#import "MainRowType.h" 

@interface WatchTableController : WKInterfaceController 


@property (strong, nonatomic) IBOutlet WKInterfaceTable *tableView; 
@property (strong, nonatomic) NSMutableArray *titleArray; 


@end 

.m

Io chiamo questo metodo

- (void)configureTableWithData:(NSMutableArray*)dataObjects { 

    [self.tableView setNumberOfRows:[dataObjects count] withRowType:@"mainRowType"]; 

    for (NSInteger i = 0; i < self.tableView.numberOfRows; i++) { 
     MainRowType* theRow = [self.tableView rowControllerAtIndex:i]; 
     NSString *titleString = [dataObjects objectAtIndex:i]; 

     [theRow.title setText:titleString]; 

    } 
} 

Grazie

risposta

11

La tua struttura title è il problema. Non puoi nominare un "titolo" di proprietà in quelle classi. Cambia il nome della proprietà e dovresti essere tutto pronto.

+0

Grazie! Lavorando ora ... che stupido :) cercavo ore ... – Kreuzberg