WKInterfaceController background image location - xcode

I am making a WatchKit Table in a WKInterfaceController. I want the ViewController to have a background, as shown here:
I assign the background to the InterfaceController itself (not to the Table):
This works, except that the image is actually centred in the Table, not the WKInterfaceController, so that if I have a lot of rows I get this result (from Storyboard, the drawn boxes is what you see if you scroll on the watch to those rows):
The background image is located at the centre of the Table, and is only visible when the user scrolls to row 4-5 (green box).
Is it possible to keep the image centred in the ViewController, and let the rows scroll over the image, either in the Storyboard or in code?

According to Apple that is not currently possible.

Related

React Native bunch of buttons on top of background image

I have a background image and I need to add bunch of oval buttons or images on in my case the "greenish" buttons on top of the background image, that I can click in each one of them and call a function passing a parameter. Please look on the screen shot and let me know how I can position every one of the buttons on top of the image and access them with a click (onPress). I guess the only way is using flex box but I couldn't figure out the style for it.
Thanks
Just style all the green buttons on relatively to the image's boundaries with position: absolute. Percentage values for positioning should work, if your image scales properly on screen size change.

How to get background images to scale to the same size in Xcode Autolayout?

The Problem:
I am currently trying to get the background image of launch page of my app and the first view controller to match in size.
On left, launch screen on the right first view controller.
However as you can see the navigation bar appears to resize the background image.
Both back ground images are currently set to centre vertically and horizontally and both have equal width and height to the view.
What Ive tried
I have obviously tried messing around with auto layout to now avail,
I have also tried toggling the Extend Edges “under Top Bars” option, it is currently set to true in the above image. This didn't work either.
Question
How do I get both background images to have the same sizes (consistent) between the launch screen and the first view controller, for all iPhone devices (in auto layout)?
Found the answer for anyone with this problem.
Tick extend edges under Opaque bars for the view controller.

CorePlot plot view in NSTableView animates badly upon collapse/expansion

I have implemented a calendar view (GitHub). When you click on a day cell, a NSTableViewRow is inserted below, containing details for the day.
Insertion and deletion is animated as NSTableViewAnimationSlideDown and NSTableViewAnimationSlideUp respectively. The standard AppKit components seem to simply vanish during the animation. That was weird enough for a few test labels, but Core Plot and it's CPTGraphHostingViews don't play along nicely:
The plot view (containing 1 bar plot) appears outside the visible range of the row view and jumps into place once the row finished its animation. See animated GIF below:
The row view contains a custom view with 2 labels and 1 plot view. The custom view is pinned to all 4 edges of to the row view via AutoLayout (in code). I added Auto Layout constraints to the plot and labels relative to the edges of the parent custom view. I had hoped this would resize the plot according to the animation, but it doesn't seem to resize but move instead (slide not shrink).
How can I stick the plot view to the row's bottom during animation and clip it while the row slides?
Ordering the plot behind the rest of the table seems to be my first problem here.
I have no clue why the plot, drawing above the rest or not, doesn't slide animated.
Turned out it was an issue with Core Plot being based on CALayers, which don't animate well in a solely view-based table. After fiddling with different ideas for a while, I got it working with setWantsLayer:YES, sent to the container view (not the NSTableView! That didn't work out well).
This can be done in Interface Builder easily:

How to resize between 3.5" and 4" screens (dynamic constraints in autolayout?)

I have one view filling the screen with a background image. Other views (text fields) are in exact positions (the background image includes the text field background images). When I change from 3.5" screen to 4", the text fields don't change in the same way that the background resizes. The bg image simply resizes to fill the screen, but the text fields jump out of alignment.
Is there a way to have two sets of constraints, one for each screen size? or is there a way to have views resize proportionally to another view?
EDIT:
Is there a way to have two sets of constraints, one for each screen
size?
Yes, by adding constraints programatically and checking [[UIScreen mainScreen] bounds] to get the screen size.
or is there a way to have views resize proportionally to another view?
Yes, you could set this up in interface builder. But it will be hard to manage, I would manage the constraints manually in code since you are using a custom background image the textviews need to position exactly
You're going to struggle to get these things to line up properly with the text view backgrounds being part of the background image.
You should amend your image assets and use the background property of UITextField to have an actual background image, and remove the boxes from your main background image. The icons could be separate images as well.
Failing that, it would make more sense to have the image stretch underneath the text boxes rather than on top.
Your layout is doing what it should do based on your description, but the image isn't stretching in the right way. In your screenshots, username is always the same distance from the top, and the others are the same distance from the bottom, but that isn't how image stretching works. I don't know how you've set it up but it would make sense to have a single image the size of the 4 inch screen, which has the bottom cut off for 3.5 inch devices, and constrain everything from the top.

NSTableView with overlapping corner views has odd scrolling

I'm trying to implement an NSTableView with rounded corners. The approach I took was to put a container on top of the table view that has images only on the corners to produce the rounded effect. The problem I'm having is that when the table scrolls, the corner images scroll with the row they were drawn on. Does anyone have insights as to why this is occurring?
Edit: I tried putting a button in the center of the corner image container and it seems like the NSScrollView is going on top when it's scrolling. When it scrolls, the button is also disappearing from the view. Is the scroll view known to do this?
Solved. I took the approach of creating a child window overlay. An example of this: http://lists.apple.com/archives/Cocoa-dev/2006/Apr/msg01638.html

Resources