cornerradius

UITableView comes to a crawl when adding a UILabel with cornerRadius to each cell

孤人 提交于 2019-11-29 02:13:16
I'm adding a UILabel to each cell in my table view. This presents no problem initially. When I round the corners of the UILabel using layer.cornerRadius scrolling the table view grinds to a halt. UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(cell.bounds.origin.x+10 ,5, 30, 30)]; label1.backgroundColor = ([[managedObject valueForKey:@"color"] hasPrefix:@"FFFFFF"]) ? [UIColor blackColor] : color; label1.layer.cornerRadius = 10.0f; [cell addSubview:label1]; I've tried this before myself and found that it's useless for any kind of view that moves. You should create an image with

Android round edges on ring shaped progressbar

徘徊边缘 提交于 2019-11-28 18:42:43
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="@dimen/seven_dp"> <solid android:color="#477C5B"/> <stroke android:width="1dip" android:color="#FFFF"/>

Different cornerRadius for each corner Swift 3 - iOS

时光怂恿深爱的人放手 提交于 2019-11-28 11:59:26
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 Marcos Griselli You could set the default layer.cornerRadius to the smallest value and then set the layer mask's border to the bigger value. let demoView = UIView(frame: CGRect(x: 100, y: 200,

what is relation between masksToBounds and cornerRadius?

孤人 提交于 2019-11-28 07:36:45
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 cornerRadius and masksToBounds . I'm afraid of unexpected issues with this setting. Thank you. Paresh Navadiya

Something's wrong in Corner radius Android

☆樱花仙子☆ 提交于 2019-11-27 15:30:18
I'm making my own search view for Android 2.3. I have. LinearLayout (Horizontal) AutoCompleteTextView ImageButton I added the button and AutoCompleteTextView to LinearLayout . I want to put a corner radius in my own control like the image shown below. I set this drawable to ImageButton <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" > <shape> <solid android:color="#27AFE0" /> <stroke android:width="0.5dp" android:color="#000000" /> <corners android:topRightRadius="10dp" android:bottomRightRadius="10dp" android:topLeftRadius="0.1dp"

How to set corner radius of imageView?

走远了吗. 提交于 2019-11-27 10:14:22
问题 In Objective-C such line self.mainImageView.layer.cornerRadius = CGRectGetWidth(self.mainImageView.frame)/4.0f; does its job, I tried it in Swift using analogy self.mainImageView.layer.cornerRadius = CGRectGetWidth(self.mainImageView.frame)/4.0 and it doesn't change anything, the corners are the same as before. Moreover, Xcode does not show any syntax errors. Does Swift support any other way to reach this goal? I checked some other threads here and usually it's getting done in Swift in the

Swift - Problems with corner radius and drop shadow

元气小坏坏 提交于 2019-11-27 10:12:35
I'm trying to create a button with rounded corners and a drop shadow . No matter how I switch up, the button will not display correctly. I've tried masksToBounds = false and masksToBounds = true , but either the corner radius works and the shadow does not or the shadow works and the corner radius doesn't clip the corners of the button. import UIKit import QuartzCore @IBDesignable class Button : UIButton { @IBInspectable var masksToBounds: Bool = false {didSet{updateLayerProperties()}} @IBInspectable var cornerRadius : CGFloat = 0 {didSet{updateLayerProperties()}} @IBInspectable var borderWidth

How to set NSString's background cornerRadius on iOS7

浪子不回头ぞ 提交于 2019-11-27 07:08:54
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 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 = [[NSTextStorage alloc] initWithString:@"Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed

Something's wrong in Corner radius Android

大兔子大兔子 提交于 2019-11-27 04:06:50
问题 I'm making my own search view for Android 2.3. I have. LinearLayout (Horizontal) AutoCompleteTextView ImageButton I added the button and AutoCompleteTextView to LinearLayout . I want to put a corner radius in my own control like the image shown below. I set this drawable to ImageButton <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" > <shape> <solid android:color="#27AFE0" /> <stroke android:width="0.5dp" android:color="#000000" />

UIView animateWithDuration doesn't animate cornerRadius variation

随声附和 提交于 2019-11-27 03:29:27
I'm trying to animate the change of the cornerRadius of a UIView instance layer , but the variation of the cornerRadius takes place immediately. Here's the code: UIView *view = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)]; view.layer.masksToBounds = YES; view.layer.cornerRadius = 10.0; [UIView animateWithDuration:1.0 animations:^{ [view.layer.cornerRadius = 0.0; }]; Thanks everybody who is going to give me any tips. EDIT: I managed to animate this property using Core Animation , using a CABasicAnimation . CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@