uikit

How to change height of grouped UITableView header?

回眸只為那壹抹淺笑 提交于 2019-12-17 17:24:27
问题 I know how to change the height of the section headers in the table view. But I am unable to find any solution to change the default spacing before the first section. Right now I have this code: - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section == 0){ return 0; } return 10; } 回答1: Return CGFLOAT_MIN instead of 0 for your desired section height. Returning 0 causes UITableView to use a default value. This is undocumented behavior. If you

How to draw a smooth circle with CAShapeLayer and UIBezierPath?

我们两清 提交于 2019-12-17 17:23:48
问题 I am attempting to draw a stroked circle by using a CAShapeLayer and setting a circular path on it. However, this method is consistently less accurate when rendered to the screen than using borderRadius or drawing the path in a CGContextRef directly. Here are the results of all three methods: Notice that the third is poorly rendered, especially inside the stroke on the top and bottom. I have set the contentsScale property to [UIScreen mainScreen].scale . Here is my drawing code for these

On iOS, if a superview's userInteractionEnabled is NO, then all subviews are disabled as well?

六月ゝ 毕业季﹏ 提交于 2019-12-17 16:43:10
问题 I thought when a view is touched or tapped on, its handler get called first, and then its superview's handler is called (propagate upward). But is it true that if the superview's userInteractionEnabled is set to NO, then all subviews and offspring is also disabled for user interaction? What if we want to disable for just the main view but don't want to disable for the subviews? 回答1: You cant do that, Instead you would change the arrangment of your views like following: Main View-> subViews To

Transparent UIPopover

此生再无相见时 提交于 2019-12-17 16:37:37
问题 Is there a way to make the UIPopOver transparent (alpha = 0.75 or so). Unfortunately there is no alpha property for UIPopOver. I need to present a popover so that the view beneath it will still be partially visible. Any ideas 回答1: popoverController.contentViewController.view.alpha = 0.5; alpha is an property of an UIView so you need to get the view of the popOver and then set the alpha to that view. 回答2: Starting with iOS5.0, one can provide a custom background for the UIPopoverController .

iOS: How to access the `UIKeyboard`?

≯℡__Kan透↙ 提交于 2019-12-17 16:29:08
问题 I want to get a pointer reference to UIKeyboard *keyboard to the keyboard on screen so that I can add a transparent subview to it, covering it completely, to achieve the effect of disabling the UIKeyboard without hiding it. In doing this, can I assume that there's only one UIKeyboard on the screen at a time? I.e., is it a singleton? Where's the method [UIKeyboard sharedInstance] . Brownie points if you implement that method via a category. Or, even more brownie points if you convince me why

Supporting both iOS 6 and iOS 5 autorotation

巧了我就是萌 提交于 2019-12-17 16:27:49
问题 Can anyone confirm that to support both iOS 6 and iOS 5 there is no point to adding the new iOS 6 autorotation methods, since the Apple docs suggest that these methods are completely ignored if you are also implementing the iOS 5 methods? In particular, I talking about the methods - (NSUInteger)supportedInterfaceOrientations and - (BOOL) shouldAutorotate -- that these are ignored and synthesized by the compiler if you also implement the - (BOOL)shouldAutorotateToInterfaceOrientation:

Reporting incorrect bounds in landscape Mode

寵の児 提交于 2019-12-17 15:36:26
问题 I am having an issue with Landscape mode in my iPad application. I created a very small new project to show my issue I set UIInterfaceOrientation in the pList to UIInterfaceOrientationLandscapeRight In app delegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self.window makeKeyAndVisible]; MyController *myController = [[MyController alloc] init]; [self.window addSubview:myController.view]; return YES; } In MyController -

How do I create a 1px line in Interface Builder?

可紊 提交于 2019-12-17 15:22:47
问题 Note, I'm looking to make a 1px line, not a 1pt line. Meaning it should be 1px regardless of screen scale (so 0.5pt on Retina devices). I can do this programmatically, but can I do it in the Interface Builder? For example I cannot set a UIView to have a height of less than 1. If I can do it in IB then I don't have to declare an outlet and manually set the frame in awakeFromNib . 回答1: Xcode 7.3 right down corner: add Height constraint in Pin. 回答2: Just in case someone else comes here wanting

Crop a CAShapeLayer retrieving the external path

时光毁灭记忆、已成空白 提交于 2019-12-17 10:35:16
问题 I am trying to crop a layer with other, but, instead of creating a mask (B) and crop the layer (A) getting a cropped layer A with the shape of B, I want to get a layer with shape A and a 'hole' created by cropping with layer B. ************* ***Layer A*** * Layer A * ************* * ***** * **** ***** * * B * * -> **** ***** Layer A without shape B * ***** * **** ***** * * ************* ************* ************* How can I get the cropped layer A? 回答1: You have to create a mask that covers

Difference between addSubview and insertSubview in UIView class

社会主义新天地 提交于 2019-12-17 10:20:13
问题 What is the difference between addSubview and insertSubView methods when a view is added programmatically? 回答1: The only difference is in where the view is added: whether it is the frontmost view ( addSubview: ), or it is before the 5th subview, ( insertSubview:atIndex: ) or if it is immediately behind another subview ( insertSubview:aboveSubview: ). 回答2: Using insertSubView: you can specify the index, which determines z-order of views. A view with a higher index lies above those with lower