2014年2月20日 星期四

實作property的getter跟setter

@interface BLEManager : NSObject{
    CBPeripheral* _activePeripheral;
}



//實作activePeripheralgetter
-(CBPeripheral*) activePeripheral{
    return _centralController.activePeripheral;
}
//實作activePeripheralsetter
-(void) setActivePeripheral:(CBPeripheral *)activePeripheral{
    _activePeripheral = activePeripheral;

}

Note.實作完之後,就要手動完成property的其他事情。

沒有留言:

張貼留言