I am facing problem with wearable listview,I have more than 3 textview to show in wearable listview item,but it from bottom due to har coded heigth of list item.Is there any way to change the height of item.
You cannot change that if you user WearableListView. You can write your own RecyclerView extension to do as you wish.
Related
I am trying to make a NSSearchField taking up the whole width of a toolbar in a NSWindowController.
I created a new NSWindowController using Xcode storyboard, add a toolbar to it, when add search field to the toolbar.
I drag the search field from allowed toolbar items to default toolbar items
Set toolbar item's max width to a large number say 1000
I build the app and run. The search field shrinks when window width shrinks, but does not expand beyond a certain width when window width expands.
The question is how to make search field expand and take up all remaining space of the toolbar?
It doesn't sound to me like the toolbar is really what you want to use here. The purpose of the toolbar is to allow multiple UI elements to be included in a user-configurable way. If you want to force one element that takes up the entire width, I suggest just putting it in the window's content view and setting up the layout constraints to pin to both the left and right sides. If you set the "Textured" check box in Interface Builder, it should look roughly the same as it would have looked using the toolbar.
Writing an app for macOS using Xcode 8.2. After adding a toolbar to my window and a NSSegmentedControl, the label View for the toolbar item is not centered. Both in the storyboard and as the app is running.
Why?
It looks to me like the size of your toolbar item is mismatched to the size of the view. If you change the maximum size of your toolbar item so that it can't expand beyond the size of the segmented control, you should be good to go.
I have a list with titles coming from data source. The length of the title is unknown and could be one line, two lines and even more... under the title I want to place the name of the author of the post.
I placed the two labels (the title label and the author label inside a View with layout: 'vertical' which places the author label under the title label. But still had to somehow limit the number of rows displayed by the title - I want to have maximum 2 rows. So I've set the height of the subject label.
While setting the height of the label does limit the number of rows displayed, it causes another problem - on rows where the title is 2 lines or more everything looks great. but on rows where the title is only one row, there's now space between that row and the author name - and I want to have the author name right under the label (important thing to notice - the author label has a different font size and color than the title).
If it was just plain old html I would just set max-height css property - but Titanium doesn't have that kind of property on Views/Labels. Is there a way to have maximum height on a View?
There is no such property max-height being supported by Appcelerator for views. But what you can do is, you can listen for the postlayout event for the view and once triggered you can get the rect, to get the height of the view. Now in here you can do your magic. If the height of the view is greater than some value you want, then you can fix it, else let is remain as is.
Do let us know if it works for you. If not, we can try to come up with some other solution.
On Android you can use maxLines on a Label.
For Views and iOS you could do the following. Set the view's height:Ti.UI.SIZE and use bottom to set the minimum space between the views bottom and that of its parent. This only works if the parent has a fixed size.
Listening to post layout on a ListView won't work since you would have to set this on the ListView but don't have a way to access the rect or size property of the ListItem views.
I've just added the numberOfLines in the iOS SDK: https://jira.appcelerator.org/browse/TIMOB-24071
It's called maxLines for Android parity. It really works for Labels inside ListView templates.
So I'm using the method:
[someWindow setContentBorderThickness:24.0 forEdge:NSMaxYEdge];
But I can't seem to get the toolbar to increase in height. It simply stays the same as in default. Can anyone shed some light here?
An NSToolbar is automatically resized to accommodate the height of the tallest NSToolbarItem. The standard (large) toolbar items are all 32 px tall, so the toolbar has no need to make itself larger. If you do something like add a custom view toolbar item, then it will be resized to accommodate that item, as shown in the image below:
(To accomplish the result shown above, I clicked on the toolbar twice in IB to bring down the Allowed Toolbar Items sheet, then dragged an NSView custom view from the library palette onto that sheet).
P.S. I'd recommend using this capability with discretion.
You cannot specify an arbitrary height for NSToolbar. You can, however, specify a size mode. A toolbar with 24x24-pixel icons has a small size mode:
[toolbar setSizeMode: NSToolbarSizeModeSmall];
which is equivalent to Size: Small in Interface Builder’s Attributes Inspector.
I want to change the height of an NSWindow titlebar.
Here are some examples:
And…
I could use an NSToolbar, but the problem is that I can't place views very height (For example: I can't place the segmentedControl higher than in the picture because there is still the titlebar)
If I remove the titlebar I can't place a NSToolbar and the window isn't movable.
Have you any ideas?
This is much easier than one would think. I too went on a quest to do something similar for my app.
Real App Store app:
My App Store app look-alike:
No disrespect to INAppStoreWindow, it is a very good implementation and solid. The only draw back I saw from it though was that there was a lot of drawing code along with hardcoded settings for the TitleBar colors which Apple can adjust at anytime.
So here is how I did it:
A) Create a standard window with a Title Bar, Close, Minimize, Shadow, Resize, Full Screen - Primary Window all set.
Note: You do not need a textured window nor should you set a title
B) Next add a standard toolbar with these settings:
Icon Only
Visible at Launch - ON
Customizable - OFF
Separator - ON
Size - Regular
Remove all the Toolbar Items and add only these in the following order
NSSegmentControl (51 x 24) -- | Flexible Space | -- NSSearchField (150 x 25)
C) In your content View directly under the toolbar add a regular sized NSButton set like so:
Bordered - OFF
Transparent - OFF
Title -
Image -
Position - Text below the button
Font - System Small 11
Ok, pretty easy so far, right?!
In your Window Controller or app delegate....
setup IBOutlet(s) to your NSButton(s)
Note: Remember to hook up your IBOutlet in interface builder
Ok don't be scared we have to write a tiny bit of code now:
In awakeFromNib or windowDidLoad....
Get the content views' superview (aka NSThemeView)
Remove your button from its superView
Set the frame of your button
Add the button back to the theme view
So the code would look similar to this:
NSView *themeView = [self.contentView superview];
NSUInteger adj = 6;
[self.btnFeatured removeFromSuperview];
self.btnFeatured.frame = NSMakeRect( self.btnFeatured.frame.origin.x,
self.window.frame.size.height - self.btnFeatured.frame.size.height - adj,
self.btnFeatured.frame.size.width, self.btnFeatured.frame.size.height);
[themeView addSubview:self.btnFeatured];
That's it! You can use your outlet to enable/disable your button, setup a mask image when selected, enable/disable the toolbar or even hide everything and add a window title. All of this without worry if Apple changes their standard Window Titlebars.
P.S. No private frameworks were used in this posting whatsoever!
INAppStoreWindow is a NSWindow subclass, it tell you how to change the height of title bar.
https://github.com/indragiek/INAppStoreWindow
http://iloveco.de/adding-a-titlebar-accessory-view-to-a-window/
This example tells you how to add buttons in the title bar.
You'd have to subclass NSWindow and do a custom window frame drawing. It's not only about a titlebar. It's about whole window frame (so you can, actually, put close/minimize/zoom buttons at the bottom if you wish).
A good starter is at "Cocoa with love" website.
There are a few new solutions based on INAppStoreWindow and without warning and log message, for anyone who wants to change the height of NStitlebar, change the position of traffic light, add an item(e.g. a NSbutton) on NStitlebar and change its position, please check below.
WAYWindow:
https://github.com/weAreYeah/WAYWindow
NStitlebar_with_item:
https://github.com/ZHANGneuro/NStitlebar_with_item