Can I add button on Map in watchkit? - ios

I'm trying to build an app for Apple Watch OS 2, so I was wondering is it possible to add buttons or images on top of the map?

As far as I know, there isn't such a thing like "multiple layers", as you might call it, which would allow you to arrange a thing on top of another thing, in WatchOS yet.
So, I don't think, that the thing you want would work, sorry.

You would need to do your own tile rendering to do something like that. I have four buttons over the top of my maps and I render custom waypoints and routes on the map. To do that I have a custom tile render that generates an image that I set for the watch background and then I overlay buttons on top of it. Here is some more info on how I overlay the buttons Is it possible to position views on top of each other. (One thing that has changed since that post is that I no longer break the background up into four images, I can just set the background as a single image. Somehow I missed that when I initially read the API docs. Also, I turned off the animations for watchOS 1 and I have them on for watchOS 2.)

Related

How to Make a Programmable Tile View (Like the App Store Has)?

I'm building an app, and I want the main view to be "tile" based, kind of like how the App Store looks:
In other words, I'd like to be able to add rounded "tiles" (like the get fit, now trending) to my view with certain information- a method that adds tiles in certain scenarios, with certain information. I'd also like the view to be scrollable, and the tiles to expand and reveal more information when clicked.
I have no idea how to start this, so I'm sorry for the vagueness, but any help is appreciated.
Anyone looking to make a UI like the App Store's today page will find what they want in the Cocoapod called "Cards."

How can I get a [Glance] Interface Controller / blank slate for Apple Watch?

In the default storyboard for an Apple Watch application, the Interface Controller has a black rectangle at the top with the time, and the Glance Interface Controller has two Groups.
I would like for both to have the viewport completely covered by my imagery, with a background image that exactly fits the Apple Watch viewport, and a UIImageView portraying a partially transparent PNG, rotated and translated.
I've so far tried and failed to find out how to manipulate XCode's UI to delete e.g. the two Groups in the Glance image.
Is fully covering the viewport available for Glances and/or the main interface, and if so, how?
Thanks,
If I remember correctly this is not possible since all glances should basically provide some similar structure.

MKMapView "Legal" Label necessary for custom maps?

I´m using MKMapView for displaying MKTileOverlays. The overlays are drawn by myself and i don't show any map data from Apple or Google. Do I need the "Legal" label on top of the map? I only use the MKMapView to display custom tiles and put some custom annotations on it. Do I really need the legal patch here? Will my app be rejected if I drop it?
The legal link is required by Apple and there is some possibility that your app will get rejected if you remove it by using private class i.e. (if you loop the subviews of the map for MKAttributedLabel and remove/hide it). Your case is a bit more challenging of their rules due to the usage of tiles, but on a previous project of mine, where I needed a small mapView and the link was appearing quite bad on that small area, I extended the bottom area of the map a bit so that link is obscured by the view in front of it. The app got published without a problem.

How does Uber achieve this UI in WatchKit?

How does it superimpose elements (the timer is above the map) ?
To my understanding, you can only use background images on groups, no other kind of custom views...
Any idea ?
My initial guess is that they're using a dynamically-generated image of a map as the background image in the group. The giveaway is that, while WKInterfaceMap allows you to add custom annotations, you can't draw custom shapes like the blue route line.
I could be way off.
The way Uber (and most of the big companies custom's UI) is done is that they're just generating an image in the iOS which is the sent back to the WatchKit extensions and simply displayed as an image.
If you want to create your custom UI with hte current version of the SDK, this is the only way to achieve exactly what you want. You will need some hacks to achieve interactivity but you should be able to do that on your own :)

How can i stack up tiles in iOS programming?

I'm trying to learn iOS programming and I decided to make a game like Connect 4, or some may know it as Four in a row.
I've done the grid and dropping the tiles. However, I haven't been able to stack the tiles on top of each other. I havent tried that much because I have no idea on how i could do something like that as i have never tried making a game like this, I have also searched online but I dont know if it's my choice of wording that it never shows anything or if there isnt anything like it.
I have 7 column on the top, with a hairline where you touch in order to drop the tile to the grid. Right now the tiles just stack on each other.
Not sure if my response is worth to be an answer but what the heck...
If you are set on not getting into Sprite Kit right now, you could probably use UIButton to make this happen. Divide your screen into a grid of UIButtons. You can set the button images according to empty and played (red or blue). Each button code would have to check for things like if the hole (button) was already played, what color chip to display, is this a winning move, etc... There is of course an easier way to do this instead of copying the same code into each button but I'll let you try to figure that one out for now.

Resources