watchkit

WatchKit app losing data after going background - Swift

非 Y 不嫁゛ 提交于 2020-02-24 11:32:49
问题 I'm passing a dictionary from my iPhone to the watch using the (watchOS 2) applicationContext method. Inside the iPhone app: func giveMeInfo(){ var lastStringUsed = porkee288.storyPoints.last! do { let resultDict = ["dict": myDict] try WCSession.defaultSession().updateApplicationContext(resultDict) } catch { print("Something wrong happened") } } Inside the watch app: func session(session: WCSession, didReceiveApplicationContext applicationContext: [String : AnyObject]) { dispatch_async

Watchkit Multi-line label with Top Aligment

末鹿安然 提交于 2020-02-06 03:17:19
问题 Want to add a multi-line label to a tablerowcontroller with top alignment. The only alignment options are left/right etc. Looks like it automatically centers the text vertically. Anyway to force top alignment? Using iOS8/Xcode 6.3.2 回答1: Table Row Controller is a Group . You can change the Group Layout to Vertical. You can also insert a Group into another Group , and control individual layout. Nested groups can help you to fine-tune the layout you desire: Nest a vertical group into the

Watchkit Multi-line label with Top Aligment

人盡茶涼 提交于 2020-02-06 03:16:12
问题 Want to add a multi-line label to a tablerowcontroller with top alignment. The only alignment options are left/right etc. Looks like it automatically centers the text vertically. Anyway to force top alignment? Using iOS8/Xcode 6.3.2 回答1: Table Row Controller is a Group . You can change the Group Layout to Vertical. You can also insert a Group into another Group , and control individual layout. Nested groups can help you to fine-tune the layout you desire: Nest a vertical group into the

How does the inbuilt Workout app on Apple Watch navigate from main table row to a set of page-based controllers?

早过忘川 提交于 2020-02-02 11:12:30
问题 I was trying to mimic the Workout app for practise. And I got stuck at figuring out how to do this navigation from these table rows in the main screen to the 3/4 Workout starting screens which are page-based and seem to be hierarchical, with a back button on top left. They are most certainly not Modal as they do not appear from the bottom. - - -> However I did not find any way to connect a row to a set of page-based interface controllers with push segue. This is what I tried: 1-

TouchEvents in watchOS 3 SpriteKit?

a 夏天 提交于 2020-01-23 07:41:35
问题 When using SpriteKit in watchOS 3, how do you handle the touch events? I am porting the SpriteKit games from iOS and the codes below won't work. Or you have to control the WKInterfaceController somehow? override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {} override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {} override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {} override func touchesEnded(_ touches: Set<UITouch>, with

TouchEvents in watchOS 3 SpriteKit?

落爺英雄遲暮 提交于 2020-01-23 07:41:34
问题 When using SpriteKit in watchOS 3, how do you handle the touch events? I am porting the SpriteKit games from iOS and the codes below won't work. Or you have to control the WKInterfaceController somehow? override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {} override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {} override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {} override func touchesEnded(_ touches: Set<UITouch>, with

Apple Watch Table - first 4 rows not appearing

我的梦境 提交于 2020-01-22 20:54:28
问题 I'm having problems adding rows to WKInterfaceTable on Apple Watch. The weird thing is that no matter what I do, the first 4 rows appear as empty. I tried adding rows manually and in a loop - doesn't matter. I believe my code is good because 5th and further rows appear just fine. Here's what happens: Scroll further: My code: import Foundation import WatchKit class TableInterfaceController: WKInterfaceController{ @IBOutlet weak var agentTable: WKInterfaceTable! let agents = ["The Dude","Walter

How to get the index of WKInterfacebutton Tapped in WKinterfaceTable?

那年仲夏 提交于 2020-01-22 02:03:32
问题 My Code is -(void)addSelectionTarget:(id)target action:(SEL)action { //You will need to add properties for these. self.selectionTarget = target; self.selectionAction = action; } //Call this when you want to call back to your interface controller - (void)fireSelectionAction { [self.selectionTarget performSelector:self.selectionAction]; //Or to do it without warnings on ARC IMP imp = [self.selectionTarget methodForSelector:self.selectionAction]; void (*func)(id, SEL) = (void *)imp; func(self

Access workout data even when apple watch screen turn off

这一生的挚爱 提交于 2020-01-20 02:53:05
问题 I success to get heart rate data in live without workout session on apple watch os 2. But when apple watch screen turn off, my completion block is not anymore called. I would like to continue to manage these data in live and to make my phone ring when heart rate is too low. Maybe i can let the app on the iphone perma open and maybe it can access to the healthkit data during this workout ? Do you think this can work ? or do you have another idea ? Regards 回答1: Hey i found a solution : i keep

Camera live View in apple watch

北城以北 提交于 2020-01-17 08:43:08
问题 On 3/9 apple demo. They show how to use apple watch to see the camera live view and open the garage door. I think they should integrate with HomeKit to control the garage door, but how to get the camera live view?? Do these live view images come from iphone app? then using bluetooth to pass the image data to watch? 回答1: The iOS parent app to the Watch app most likely integrates with HomeKit to control the garage door and the webcam. In order to display the images from the webcam on the Watch,