iOS Question Individually change corner radius of a view

Mike1970

Well-Known Member
Licensed 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
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
Top