uikit

Animate colour of circle drawn using CGContextFillEllipseInRect

强颜欢笑 提交于 2019-12-13 04:47:55
问题 I have a UIView that draws a circle inside it using the following code: -(void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, myColor); CGContextFillEllipseInRest(context, myRect); } I want to animate this circle to a grey color... How can I achieve this? -(void)fadeToGrey { // What goes here? } 回答1: You should use CAShapeLayer as a layer class and do your drawing inside setLayerProperties: method. drawRect: will not be

UIWebView on UITableView prevents tablecell Selection

回眸只為那壹抹淺笑 提交于 2019-12-13 04:27:53
问题 I have a UIWebView on my tablecells. There are large content and it should be scrollable. But the webview prevents Tableview didselect delegate. How to overcome this. Ihf I make userinteractionenabled=NO; scrolling is not working. Any solution please help. Thanks in advance. 回答1: Try using the override of hitTest - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { id hitView = [super hitTest:point withEvent:event]; if (hitView == self) { return nil; } else { return hitView; } }

problem with navigationController

元气小坏坏 提交于 2019-12-13 04:24:25
问题 [sorry for my weak english] I have some method to create and show some new view controler (on top of my current view controler level) - (void) switchToDifficultyMenu { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; DifficultyMenuController *difficultyMenuController = [[DifficultyMenuController alloc] init]; NSLog(@"navigation controller %@" , self.navigationController); //navContr is nil [self.navigationController pushViewController: difficultyMenuController animated: NO];

Animate transform.scale with UIViewAnimationOptionBeginFromCurrentState not working as expected

心已入冬 提交于 2019-12-13 03:59:31
问题 I want to animate scale property of UIView (self.square) to 10%: - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [UIView animateWithDuration:2 delay:0.0 options: UIViewAnimationOptionBeginFromCurrentState animations:^{ self.square.layer.affineTransform = CGAffineTransformMakeScale(0.1f, 0.1f); }completion:^(BOOL finished){ }]; [self performSelector:@selector(animationInterrupt) withObject:nil afterDelay:1]; } I want to interrupt animation somewhere in the middle (e.g.:

How to print RGB color's name in objective c?

我是研究僧i 提交于 2019-12-13 03:59:22
问题 I select the color in RGB and save it in string with color name my code color =[UIColor colorWithRed:255/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:pixel[3]/255.0]; Current Output: Color print: 1 0 0 1 Expected output: Color = Red 回答1: I don't think there is a way to print the name of the color. There are plenty of such combinations. You can print the RGB values as a string though: CGColorRef colorRef = [UIColor grayColor].CGColor; NSString *colorString = [CIColor colorWithCGColor:colorRef]

how to change backgroundcolor of uibutton programatically

南笙酒味 提交于 2019-12-13 03:50:54
问题 I want to change the background color of a button to black. I have tried so many codes. but didn't works fine. How would I do it? 回答1: If you want to programatically change the colour of button you will have to make the type of button as custom as :- UIButton *button = [UIButton buttonWithType:uibuttontypecustom]; note "uibuttontypecustom" and then you can change backgroung by [btn setBackgroundColor:[UIColor blackColor]]; or you can set a black backgroung image by using steImage method on

Interacting with contents of UIPopoverPresentationController on regular sized iPhones?

本小妞迷上赌 提交于 2019-12-13 03:50:00
问题 It appears - at least by default, that while you can interact with the contents of a popover on a plus iPhone and dismiss it by tapping on the background, on a regular, non plus phone, the behavior is the opposite. Does anyone know how to correct and/or configure this so that you can interact with a popover on an regular iPhone? I have a sample that demonstrates the problem here: https://github.com/chrisco314/iPhone-Popover-Test, but the relevant code is: class PresentingViewController:

How much does it matter regarding to memory if I create an CALayer rather than an UIView?

醉酒当歌 提交于 2019-12-13 03:39:46
问题 While an UIView has a memory footprint of at least 4 * width * height pixels, I wonder how that would look when I create a CALayer only. 回答1: Having done some experimenting around this in the past, I found that the added overhead of the UIView object was very minimal. 回答2: While an UIView has a memory footprint of at least 4 * width * height pixels This statement is absolutely not true. The memory overhead of a UIView (compared to a CALayer) is just the size of the instance variables of the

UIWebView paging / line cut off

痴心易碎 提交于 2019-12-13 03:28:52
问题 I am trying to page a webpage, so disable scrolling, then the second page is the same webpage scrolled down the page height. The problem I have is that the bottom of the first page often has 1/2 a line of text, then the second page has the bottom half of the line. Is there a way to ensure the entire line falls on one of the pages? Similar to Stanza etc? Thanks 回答1: You have to paginate the web page into blocks that match the height of the UIWebView. If you cannot do that manually, or you want

How do you load a view on top of another view in the iPad

三世轮回 提交于 2019-12-13 03:24:19
问题 How do you load a view on top of another view in the iPad like in the wordpress app when it asks you to setup your blog. Can you show or post me some sample code. I have an NSUSerdefaults setup so it will display this on the first launch. I would like this view to look like this http://uplr.me/files/p45064.png See how it has the shaddows and the view is darkened in the back. Thats what I am trying to do. 回答1: I got it AddViewController* firstLaunchController = [[AddViewController alloc]