cornerradius

Diamond-like UIView

风流意气都作罢 提交于 2019-12-25 06:56:05
问题 I am trying to create a UIView with corners like a shape of a diamond, as shown in the picture: I am familiar with rounding off corners: myView.layer.cornerRadius = 10 However, I want a different shape. How could I create this effect? Thanks for your help! 回答1: Best way to solve a problem like this is by using CAShapeLayer. Here's the kind of thing that would work: paste it into a playground and see how it clips off the corners. import UIKit import XCPlayground extension UIView { func

How to create UIButton in UIImageView's top left corner and bottom right corner

半腔热情 提交于 2019-12-24 03:18:15
问题 I wish to create delete button in imageview's top left corner and bottom right corner. but it doesn't look like what I needed. I wish both the buttons should be placed on corner of the Red border To create the button I used the code below UIImageView * tappedView = (UIImageView *)[recognizer view]; [tappedView.layer setBorderColor: [[UIColor redColor] CGColor]]; [tappedView.layer setBorderWidth: 2.0]; tappedView.layer.cornerRadius = 10; tappedView.layer.masksToBounds = NO; UIButton *deleteBtn

How to change the CornerRadius of the Combobox WPF

左心房为你撑大大i 提交于 2019-12-22 11:04:03
问题 I want to use a ComboBox with different CornerRadius , how can I change that simply? I've tried with Style and ControlTemplate , but without any success. 回答1: I don't know if this is simple, but creating a ControlTemplate based on the default ComboBox should do the trick. Here is an example: <Style x:Key="ComboBoxTextBoxStyle" TargetType="{x:Type TextBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TextBox}"> <Grid> <Border CornerRadius="5,0,0,5"

WKInterfaceGroup bottom corner radius

我只是一个虾纸丫 提交于 2019-12-21 06:09:09
问题 I am trying to set the corner radius for the bottom left and bottom right corners for a WKInterfaceGroup. I was able to set only one single radius value and that would change it for all the corners. I couldn't find a way to access the CALayer to specify it there either. Is there a way this can be done? Thanks! (The group would contain 2 labels and would be in contact with the sash in the dynamic notification interface.) 回答1: You asked about WKInterfaceGroup, but from your response to

How to give cornerRadius for UIBezierPath

白昼怎懂夜的黑 提交于 2019-12-21 04:45:07
问题 I created a rectangle using following code and now I need to rounded the corners of this rectangle. but I can't find a property called layer.cornerRadius, can anyone help me ? class OvalLayer: CAShapeLayer { let animationDuration: CFTimeInterval = 0.3 override init() { super.init() fillColor = Colors.green.CGColor path = ovalPathSmall.CGPath } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } var ovalPathStart: UIBezierPath { let path =

set cornerRadius and setbackgroundimage to UIButton

我的梦境 提交于 2019-12-18 10:26:37
问题 I am trying to set cornerRadius of UIButton but I dont know how to do it. If I do like this: button.layer.cornerRadius = 5; works well, if I do like this : button.layer.cornerRadius = 5; [button setBackgroundColor:[UIColor colorWithPatternImage:radialGradient]]; the corners are not rounded. I know I could solve this whit [button.layer setMasksToBounds:YES]; but I specifically looking for different solution, because I add some arrows to the button and if I set mask to bounds the arrow are

Android round edges on ring shaped progressbar

眉间皱痕 提交于 2019-12-17 22:36:19
问题 I'm trying to make a circular progress bar on android and it seems pretty straightforward task , but I'm struggling with rounding the edges of the progress and secondary progress. Is there a way to do that without making a custom view ? Using a corners radius ? or nine patch drawable ? For this view (see attachement) I'm using a simple xml file <item android:id="@android:id/progress"> <shape android:useLevel="true" android:innerRadius="@dimen/sixty_dp" android:shape="ring" android:thickness="

Different cornerRadius for each corner Swift 3 - iOS

这一生的挚爱 提交于 2019-12-17 19:57:58
问题 I want to set different corner radius for a view in Swift -3 , I am able to set the radius for the each corner to the same value like the one mentioned in the following post ,how to set cornerRadius for only top-left and top-right corner of a UIView? Is there a way I can set the corner radius in the following format ? Radius top-left: 18 Radius top-right: 18 Radius bottom-right: 3 Radius bottom-left: 18 回答1: You could set the default layer.cornerRadius to the smallest value and then set the

what is relation between masksToBounds and cornerRadius?

北慕城南 提交于 2019-12-17 18:33:22
问题 My scroll has some views that is cornerRadius = 10.0 and masksToBounds = YES . This causes a performance issue for scrolling my scroll view. Though I tried each view's shouldRasterize is set YES , the issue is not solved. However, I know the solution for this issue. That is what masksToBound is set NO . ( masksToBound's default value is NO) Although masksToBound is NO , my views's corners still have curve and the performance issue is solved, too. I want to know about relation between

How to set NSString's background cornerRadius on iOS7

社会主义新天地 提交于 2019-12-17 08:51:28
问题 I want to set NSString's background cornerRadius on iOS7. But,NSString don't have layer... Please tell me, how to set NSString's background cornerRadius on iOS7? example 回答1: You can do this by using an UITextView with a subclass of NSLayoutManager , that override -fillBackgroundRectArray:count:forCharacterRange:color: . Just a little sample how to this : @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // setup text handling NSTextStorage *textStorage = [