iOS Question Individually change corner radius of a view

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone, how can i individually change the corner radius of a view (in this case a label)?

Thanks in advance
 

Semen Matusovskiy

Well-Known Member
Licensed User
In IOS 11+ you can choose, which corners to round.
For example, you want to round left-top and right-top corners only.

In designer set Label's corner radius. In run-time after LoadLayout
B4X:
Dim no As NativeObject = Label1
no.GetField ("layer").SetField ("maskedCorners", 1 + 2)
If you want to round bottom corners use 4 + 8 instead of 1 + 2 (1 means left-top, 2 - right-top, 4 - left bottom, 8 right - bottom.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
In IOS 11+ you can choose, which corners to round.
For example, you want to round left-top and right-top corners only.

In designer set Label's corner radius. In run-time after LoadLayout
B4X:
Dim no As NativeObject = Label1
no.GetField ("layer").SetField ("maskedCorners", 1 + 2)
If you want to round bottom corners use 4 + 8 instead of 1 + 2 (1 means left-top, 2 - right-top, 4 - left bottom, 8 right - bottom.

Thanks Semen it worked!!
 
Upvote 0

MikeH

Well-Known Member
Licensed User
Longtime User
Is this possible with a listview?

I get "Types do not match" error even with listview1.as(Label)

Thanks :)
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
It's not clear, what do you name 'ListView'. If CustomListView, use, for example,
B4X:
CustomListView1.GetBase.As(NativeObject).GetField ("layer").SetField ("maskedCorners", 1 + 2)
 
Upvote 1
Top