uikit

UIButton: Making the hit area larger than the default hit area

南楼画角 提交于 2020-01-08 11:21:06
问题 I have a question dealing with UIButton and its hit area. I am using the Info Dark button in interface builder, but I am finding that the hit area is not large enough for some people's fingers. Is there a way to increase the hit area of a button either programmatically or in Interface Builder without changing the size of the InfoButton graphic? 回答1: Since I am using a background image, none of these solutions worked well for me. Here is a solution that does some fun objective-c magic and

popover doesn't display on iphone

前提是你 提交于 2020-01-07 07:25:12
问题 I followed this UIPopoverPresentationController on iPhone doesn't produce popover but doesn't produce popover on iphone. Here is the code of viewcontroller class ViewController:UIViewController,UIPopoverPresentationControllerDelegate{ override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "second"{ let secondVC = segue.destination let controller :

iPhone: problem rotating a UIView - doesn't look right

非 Y 不嫁゛ 提交于 2020-01-07 02:32:26
问题 I am adding a simple UIView to my app. This works fine, until I use the 'transform' property to rotate it: myView = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)]; myView.backgroundColor = [UIColor whiteColor]; myView.transform = CGAffineTransformMakeRotation(-0.2); [self.view addSubview:myView]; //self.view is just another generic UIView The added view is rotated, but has jagged edges - i.e. the edges have not been anti-aliased. Here's an example of what I mean: aliased vs. anti

get the UIImage (or CGImage) from drawRect

回眸只為那壹抹淺笑 提交于 2020-01-06 18:07:33
问题 I'm calling the following code from drawRect - (void) drawPartial:(UIImage *)img colour:(UIColor *)colour { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextTranslateCTM(context, 0.0, self.bounds.size.height); CGContextScaleCTM(context, 1.0, -1.0); CGContextDrawImage(context, self.frame, img.CGImage); if (colour!=nil) { CGContextSetBlendMode (context, kCGBlendModeColor ); CGContextClipToMask(context, self.bounds, img.CGImage); CGContextSetFillColor

get the UIImage (or CGImage) from drawRect

混江龙づ霸主 提交于 2020-01-06 18:07:07
问题 I'm calling the following code from drawRect - (void) drawPartial:(UIImage *)img colour:(UIColor *)colour { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextTranslateCTM(context, 0.0, self.bounds.size.height); CGContextScaleCTM(context, 1.0, -1.0); CGContextDrawImage(context, self.frame, img.CGImage); if (colour!=nil) { CGContextSetBlendMode (context, kCGBlendModeColor ); CGContextClipToMask(context, self.bounds, img.CGImage); CGContextSetFillColor

Xamarin.Forms iOS UIKit.UIImage Error

喜夏-厌秋 提交于 2020-01-06 02:18:07
问题 I've been working with making a mobile app using Xamarin.Forms. I have everything working on android, but when I try to launch on iOS I get the error: System.Exception: Could not initialize an instance of the type 'UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil. >It is possible to ignore this condition by setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false. .... Does anyone know how to solve this? Edit: Here is the code it gives me the error on, but I

Center of bounds

独自空忆成欢 提交于 2020-01-05 19:26:22
问题 I have a full screen UIScrollView to display my image, which employ some codes from PhotoScroller.app from apple sample code. I am little confused on the obtaining of the center point of the imageScrollView's bounds. ImageScrollView.m - (CGPoint)pointToCenterAfterRotation { NSLog(@"imageScrollView frame X and Y are %f and %f ",self.frame.origin.x, self.frame.origin.y); NSLog(@"imageScrollView frame Width and Height are %f and %f ",self.frame.size.width, self.frame.size.height); NSLog(@

How to draw an NSString with an specific height on to an perfectly matching bitmap?

时光总嘲笑我的痴心妄想 提交于 2020-01-05 10:04:04
问题 I have an NSString like @"Hello World" and want to convert that into an bitmap with exactly 20 pixels height. The width of the bitmap should match the width of the text. I know there are some NSString UIKit additions that can draw text, but I don't know how to draw the text with an bounding box of exactly 20 pixels height (text fits perfectly into this height) into an bitmap that has the perfect size to carry the text? Is there an easy way to do this? This must also work with Chinese,

How to draw an NSString with an specific height on to an perfectly matching bitmap?

半世苍凉 提交于 2020-01-05 10:04:01
问题 I have an NSString like @"Hello World" and want to convert that into an bitmap with exactly 20 pixels height. The width of the bitmap should match the width of the text. I know there are some NSString UIKit additions that can draw text, but I don't know how to draw the text with an bounding box of exactly 20 pixels height (text fits perfectly into this height) into an bitmap that has the perfect size to carry the text? Is there an easy way to do this? This must also work with Chinese,

Hide and show scrollview with animation

妖精的绣舞 提交于 2020-01-05 06:41:51
问题 In my app I have a scrollview and when I press a button it is hidden when I press again it shows up. I use scrollview.hidden = YES (or NO) to do it. But I want to do it with an animation. For example, it may disappear from the bottom of the screen by moving and shows up with the same way. How can I do that? edit: [UIView beginAnimations:@"myAnimation" context:nil]; CGRect Frame = bottomScroller.frame; if(Frame.origin.y == 380){ Frame.origin.y = 460; }else{ Frame.origin.y = 380; }