I want to use a WKInterfaceButton for my watch app, that looks like the buttons in the watch settings:
with two main attributes:
It should contain a small image on the left
its title should be aligned to the left
I didn't found any possibility to align the title of a button to the left. I already tried to use a group instead (then it would work), but when I use a group I can't use the the shape of WKInterfaceButton.
Here's how I would do it...
Create a button
Make that button type a group
Within that button-group, place two groups inside it. The group on the left will contain the image. The group on the right will contain a label
So place an image in the left group, and a label in the right group.
Adjust the margins, length, heights of these groups until you get the desired look.
Give the button-group a length relative to container of "1" and a height of "size to fit content"
For the inner group that will contain the image, give it a length of relative to container of "0.2" (maybe)
For the inner group on the right that will contain the label, give it a length of relative to container of "0.8" (so that together the two groups make 1)
Give both groups a height of relative to container (1)
use WKInterfaceButton Content as Group and place image and label in it.
While i haven't tried this myself i think what you're looking for to match the watch settings is a table view. Define a table view in the interface controller of your story board and add your image and label to the row(s). There's an example of how to do this in the programming guide for apple kit.
Related
So I have a table with two columns: location name and coordinates.
I created a map visualization using the coordinates and, of course, the labels on the side menu are the coordinates (as you can see in the pic below).
Is there any way to change those labels, so that the corresponding location names appear instead of the coordinates?
Thanks for the help!
To get what you want add the Location Name to the map as a dimension (instead of the coordinates) and then under Location on that map layer select the Coordinates field (it will by default use the Location Name so change this).
If you want to simplify this you can use tags in your script to say that the Coordinates field is the location data for the Location Name. You can read more about that here, but for example:
TAG FIELD [LocationName] WITH '$geoname', '$relates_Coordinates';
TAG FIELD [Coordinates] WITH '$geopoint', '$relates_LocationName';
This should then mean that when you add LocationName to a map it will automatically know to use the Coordinates to plot the location rather than LocationName.
Here is the problem I am facing:
I have a component in react native called Header. Header has 3 properties - left suffix (for back button for example), right suffix (for additional actions, sometimes 1 button, sometimes 2 buttons, sometimes none) and title.
Layout rules are as follows:
Title should always be centered in a header no matter if Right or Left suffixes are present. If Right suffix is present but Left suffix is not, title should still be centered in the middle of the header.
Right and Left suffixes should always be visible if they are declared. Meaning if I have Right Suffix + Left Suffix + a very long title, title should shrink to make space for suffixes.
I have made snack to demonstrate my problem: https://snack.expo.io/#anjayka/header-challenge
As you can see most of the layout works fine - If I add right suffix, title stays in position, if I remove left suffix - its still in position. The problem comes after title is a very long text - it expands so much that it pushes out suffixes entirely.
Any help solving this puzzle is appreciated
Just wrap the tile in View with position: 'absolute' and center the tile Text in the middle, and give the header Text style a maxWidth prop
When I move my mouse to a row in tree view and stay here for a second, I want to see a floating window. (Like in developer mode.)
How Can I solve it? Any idea?
When you declare your field or fields that get rendered on a listview make sure you give to the __init__ method the help='My Floating Test' argument. That will cause a floating window to be shown when you hover on that field.
For example check:
addons/account/models/account.py
tag_ids = fields.Many2many('account.account.tag', 'account_account_account_tag', string='Tags', help="Optional tags you may want to assign for custom reporting")
The string on the help attribu will be shown on all the views that render this field upon hovering on it and pausing for 1 second.
If you want to modify the window that is shown, you can extend the
t-name="WidgetLabel.tooltip" template that is located in addons/web/static/src/xml/base_common.xml
In a grouped table view can I control the spacing between two sections?
Agree with 'viking'.. If you are still having troubles, I have noticed that if you create the table through IB it automatically creates a table header/footer section. If you go into the measurments(in IB) and decrease/increase the height of each section you will see the spacing between grouped sections change.
tableView:heightForHeaderInSection: and tableView:heightForFooterInSection:
together these control the space in between sections of a grouped UITableView. You cannot return 0, it will use the default value if you do, so use a small float (0.01) to reduce the space to almost nothing.
implement tableView:viewForHeaderInSection: or tableView:heightForHeaderInSection:
In my example I have a table where each row is a user for example. Columns could include their name, address, email address, etc. I now need to add a column for (hypothetical example) their cat's names. While most people will have no cats and some people will have 1- 2 cats there will be the occasional person with 20 cats that create one very long row in the table. This is giving me an issue in presentation and for filtering/searching for cat names. Is there a good solution to displaying this type of data?
Have the first 50 (or whatever) characters of the field displayed as normal then put the rest in a block with its visibility set to hidden through CSS. Include a link / button / icon that will allow the user to toggle the visibility so they can see the entire value.
Several options:
Set a maximum width for the cell and allow the data to wrap
Place the content inside a wrapper tag (such as a div) and set the div with a fixed width/height and style of overflow:hidden to ensure that a particularly long word doesn't force out the width of the cell.
Truncate the output text on the server side
For cases #2 and #3, set the Title attribute of the TD tag to contain the full non-truncated text. This will present itself as a tooltip when hovering over the cell.
I would mention other CSS-based solutions but they're very sparsely supported right now, so not worth mentioning.
You might want to try doing something like what SO does. Namely, once someone reaches a certain point in their Rep, it suffixes the number and appromixates it. Ex. 10k instead of 10,236.
That way the numbers don't get out of hand.