HI~Everyone!!!
How could I add CRLF of SegmentedControl item??
thank you!!
How could I add CRLF of SegmentedControl item??
thank you!!
Dim Items As List
Items.Initialize
Items.Add("One" & CRLF & "_1_")
Items.Add("Two" & CRLF & "_2_")
SetItems(SegmentedControl1,Items,Font.CreateNew(25),False)
Sub SetItems(SC As SegmentedControl,Items As List,aFont As Font, Animated As Boolean)
Dim NaObj2 As NativeObject = SC
NaObj2.RunMethod("removeAllSegments", Null)
For i = 0 To Items.Size -1
Dim lbl As Label
lbl.Initialize("")
Dim NaObj As NativeObject = lbl
NaObj.SetField("numberOfLines",0)
lbl.Text = Items.Get(i)
lbl.TextAlignment = lbl.ALIGNMENT_CENTER
lbl.Height = SC.Height
lbl.Width = SC.Width / Items.Size
Dim cv As Canvas
cv.Initialize(lbl)
NaObj2.RunMethod("insertSegmentWithImage:atIndex:animated:",Array(cv.CreateBitmap,i,Animated))
Next
End Sub
Dim no As NativeObject = Me
no.RunMethod("setMultipleLines", Null)
#if objc
- (void)setMultipleLines {
[[UILabel appearanceWhenContainedIn:[UISegmentedControl class], nil] setNumberOfLines:0];
}
#end if
SegmentedControl1.SetItems(Array("first line" & CRLF & "second", "first line" & CRLF & "second"))