I am trying to set up a WKInterfaceTable. I followed Apples docs. My Label is not getting text and I get this error message in console:
Cannot specify setter 'setTitle:' for properties of NSObject or WKInterfaceController
How can I fix this? Objective-C please. Here s my code:
.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
I call this method
- (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];
}
}
Thanks
Your title
property is the problem. You can't name a property "title" in those classes. Change the property name and you should be all set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With