1
하나의보기에서 float 인 블루투스 장치 (batteryLevel)의 배터리 잔량이 나타납니다. 텍스트 필드에 표시하기 위해 다른보기로 전달하고 싶습니다. 이 날 80.00000하나의보기 컨트롤러에서 다른보기 컨트롤러로 데이터 가져 오기
같은 값을 제공보기 하나
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:
(CBCharacteristic *)characteristic error:(NSError *)error
{[self.testPeripheral readValueForCharacteristic:mycharacteristic];
char batlevel;
[characteristic.value getBytes:&batlevel length:1];
self.batteryLevel = (float)batlevel;
NSLog(@"level;%f",batteryLevel);}
에서
코드는 내가 표시하는 다른보기에 이것을 넣고 싶다.
은 내가
view1 *t
다음
- (void) batteryIndicatorTimer:(NSTimer *)timer {
TIBLEUIBatteryBar.progress = t.batteryLevel/100;
[t readBattery:[t testPeripheral]]; // Read battery value of keyfob again
NSLog(@"t.batterylevel:%f",t.batteryLevel);
}
에 놓여있다하지만 t.batteryLevel
에 대한 값을 얻을하지 않습니다 view2.h 파일에 시도 나는 무엇이다 잘못하고 어떻게 할 수 있습니까?
이것은 실제로 CoreBluetooth와 관련이 없으며 아키텍처의 문제입니다. 통신 클래스를 만들어 공유 인스턴스로 설정하십시오. – Larme