objective c - Redefintition of SidebarDelegate as different kind of symbol -


i have following objective c code keeps error complaining redefining when not!! trying implement nstableviewdelegate thing xcode keep complaining

#import "appdelegate.h"  #import <appkit/appkit.h>  @implementation appdelegate  - (void)applicationdidfinishlaunching:(nsnotification *)anotification {     // add hello world sidebar     [self.sidebar.tableview insertvalue:0 atindex:0 inpropertywithkey:@"hello world!"];      [self.sidebar.tableview setdelegate: sidebardelegate()]      // reload data     [self.sidebar.tableview reloaddata];   }  - (bool)applicationshouldterminateafterlastwindowclosed:(nsapplication *)theapplication {     return yes; }  @end  // sidebar delage  @implementation sidebardelegate : nsobject <nstableviewdelegate, nstableviewdatasource>;  // setting data - (void)tableview:(nstableview *)atableview setobjectvalue:(id)anobject fortablecolumn:(nstablecolumn *)atablecolumn row:(nsinteger)rowindex {     anobject = @"apples"; }  // height - (cgfloat)tableview:(nstableview *)tableview heightofrow:(nsinteger)row {     return 20; }  - (bool)tableview:(nstableview *)atableview shouldselectrow:(nsinteger)rowindex {     nslog(@"%ld", (long)rowindex);     return ((long)rowindex % 2) == 0; }  - (nsinteger)numberofrowsintableview:(nstableview *)atableview {     return 4; }  @end 

replace

[self.sidebar.tableview setdelegate: sidebardelegate()]; 

with

sidebardelegate *sidebardelegate = [[sidebardelegate alloc] init]; [self.sidebar.tableview setdelegate:sidebardelegate]; 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -