We're using Interface Builder for developing an app for the iPad and we can't figure out how to increase the height of the textfields.
When we were using IB to develop an application for osx, you could go to the textfields attributes and under the control section you could set line break to word wrap instead of clip.
When we try to use Interface Builder for iPad applications though, it doesn't have the option of changing linebreak style under attributes-->control.
Is there any way to set the height using Interface Builder or do you have to set that in the code?
It looks like the height of the rounded-style text field is locked in Interface Builder. My solution was to use another of the UITextField styles in my XIB and then call textField.borderStyle = UITextBorderStyleRoundedRect in my viewDidLoad method.
Of course, textField should be the name of the UITextField IBOutlet.
iOS UITextFields are single line only and have a fixed height.
If you want a multi-line, variable-height text entry field then use UITextView.
1 - Right click on your storyboard/xib file and select "Open as" -> "Source code".
2 - Find the xml tag relative to your TextField, e.g.
<textField opaque="NO" clipsSubviews="YES" tag="102" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="6872" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Dxw-lR-kq5">
<rect key="frame" x="20" y="337" width="335" height="30"/>
3 - Change the height value to what you want (e.g. 50)
4 - Right click again on you storyboard and select "Open as" -> "Interface builder"
5 - See the result
there is a wrapping text field,that is what you need.
set the frame of ui textfield object in view did load but it will involve coding
[self.searchText setFrame:CGRectMake(180, 450, 400, 250)];
//in my case the object was called search text...
You can edit the height of any UITextfield in IB.Just set the constraint in IB.Select the constraint.In the Size Inspector-->Select and Edit just change the constant to your desired value.Press Enter ...Done!!!! (Can't get multiline though)
Related
I tried to get the same large title behavior like the settings app on iOS when the user scrolls down. The transition between the large title and the small title is smooth. But on Xamarin Forms the header snaps.
In my NavigationPage i set PrefersLargeTitles="true". In the embedded content page i set LargeTitleDisplay="Always" and UseSafeArea="true". The content in the page looks like this:
<ContentPage.Content>
<AbsoluteLayout>
<ListView />
<Frame x:Name="LoadingFrame" /> <!-- Only visible until ListView is loaded -->
</AbsoluteLayout>
</ContentPage.Content>
I tried setting NavigationPage.IsNavigationBarTranslucent="True". Then it works, but only if i disable SafeArea (Page.UseSafeArea="False") in the ContentPage. Disabling SafeArea is not what i want, because now the content is behind the notch.
I had the same issue.
The trick was to change top constraint of list to superView instead of safe area which only works on Native.
extendedLayoutIncludesOpaqueBars = true;
On Xamarin.Forms, I tried these solutions:
Use a custom renderer to set the LayoutConstraints of the scrollable view (Doesn't work)
Create a UITableViewController in a custom renderer then convert the Xamarin TableView element to a UITableView and set it to the TableView property of the UITableViewController then PushViewController to the new UITableViewController. (work)
You can raise the problem on github for better support:
https://github.com/xamarin/Xamarin.Forms/issues
i've a NSTextField (label) centered with IB in a view with the text "__DRAG_AND_DROP_YOUR_MEDIA_HERE". In my controller a use NSLocalizedString to translate the text :
English.lproj/Localizable.strings :
"__DRAG_AND_DROP_YOUR_MEDIA_HERE" = "Drag & Drop your media here"
French.lproj/Localizable.strings :
"__DRAG_AND_DROP_YOUR_MEDIA_HERE" = "Déposer vos média ici"
Only the initial text "__DRAG_AND_DROP_YOUR_MEDIA_HERE" is centerred in the view. The translated text is not centerrd (depending on is lenght). All the translated text start at the same absciss x than the orignal text. How can i fix this issue ?
PS: I don't want to play with setFrame, height, width just for a simple point like this. I guess there's another method to do this.
Thanks.
Set the text field's alignment to NSCenterTextAlignment. You can do this from IB or programmatically using -setAlignment:.
I would like to put the font to my UILabel, i do it like this : myLabel.textColor = [UIColor colorWithRed:242.0/255 green:239.0/255 blue:236.0/255 alpha:1.0f]; My question is : how i can do exactly the same think with Interface Builder ? i know that i will use the inspector color in IB, but i don't know how to put the same think, for example how to put : red:242.0/255 in IB, and the alpha :1.0f ? thanks for your answers
place a label in IB,
go to Attribute Inspector -> Text Color-> Other
In colors window, Go to Color Sliders (2nd tab on top)
Click on Grey Scale Slider and change it to RGB Sliders.
There you can put R/G/B values as you have done in code.
You dont need to put like: x/255
just set Red as : 242
Alpha can be set between 0 - 1 with Opacity slider at the bottom 0 - 100.
How can I remove the background of search bar ? I tried by changing background color but it also changes cancel button's color !!!
Thanks...
The best alternative to this is creating a custom search bar with Ti.UI.textField and Ti.UI.button. Add them both to a view and customize it as you please. Finally, just add an event listener to the button click, and voila!
Take a look at this Module: https://github.com/viezel/NappUI
It extends the properties for several UI Elements, including SearchBar, here is the list.
SearchField BackgroundImage
Custom Cancel button
barColor - background gradient of the button. (similar to navbar)
color - color of the button title
title - change the default Cancel text
font - set the font of the button
Appearance of the keyboard
Disable the search icon
To install it, I recommend you to use the new gitTio command line, this will automatically download the module, install it on the modules folder on Application Support folder and add the proper config line on tiapp.xml.
gittio install -g dk.napp.ui
And here is an example of a SearchBar using the new properties enabled by this Module
var searchBar = Ti.UI.createSearchBar({
searchFieldBackgroundImage:"searchbg.png",
showsScopeBar:true,
scopeButtonTitles:["hello", "yes"],
customCancel:{
barColor:"#333",
color:"#ddd",
title:"Hit me",
font:{
fontSize:16,
fontWeight:"bold",
fontFamily:"Georgia"
}
},
appearance:Titanium.UI.KEYBOARD_APPEARANCE_ALERT,
barColor:"transparent",
disableSearchIcon:true //disables the search icon in the left side
});
If you are talking about the gradient blue, I removed it on my app with:
var searchBox = Ti.UI.createSearchBar({
barColor: '#eee'
});
Hope this helps.
Unfortunately 'barColor' doesn't work. Ti seems to change the color by changing the opacity or hue or something. DannyM's workaround is the best.
I must have wasted a zillion hours making sense of Titanium's background colors, background images, bar colors and their active/inactive cousins.
Conclusion: "Free" software is costly if you count the time you waste on silly bugs and lack of useful documentation.
Is it possible to use a custom color or image for the white dot of the pagingControl in a Titanium.UI.Scrollableview?
var scrollableView =Titanium.UI.createScrollableView({
views:[view1,view2,view3],
showPagingControl:true,
pagingControlHeight:30,
pagingControlColor:'transparent',
width : 200,
height : 90,
left : 120,
top:40,
maxZoomScale:2.0,
currentPage:0
});
Answer (as you said) found on http://developer.appcelerator.com/question/130397/color-pages-dot-in-a-titaniumuiscrollableview#227004 :
sorry, i dont have an example.. but here is it:
create a container view.
then create the small "dot" views, and add them to the container view. set the positions.
there is an event, when the scrollable view "scrolls" or changing.. and you can set the small dot view to active (of course you should set up the active state as well)