uiview

Black background in UIView?

巧了我就是萌 提交于 2020-01-23 05:26:09
问题 I followed a tutorial online to draw in a subclassed UIView. The tutorial showed a UIView with a white background, I fixed this by simply changing the super's bg color. The problem is, when touches end, the background does not remain clear. I have no idea. I simply tried setting the fill color to [uicolor clearcolor]; unsuccessfully. Here is the code I am using: @implementation CachedLIView { UIBezierPath *path; UIImage *incrementalImage; // (1) } - (id)initWithCoder:(NSCoder *)aDecoder { if

Swift UIView animateWithDuration completion closure called immediately

大憨熊 提交于 2020-01-23 05:05:03
问题 I'm expecting the completion closure on this UIView animation to be called after the specified duration, however it appears to be firing immediately... UIView.animateWithDuration( Double(0.2), animations: { self.frame = CGRectMake(0, -self.bounds.height, self.bounds.width, self.bounds.height) }, completion: { finished in if(finished) { self.removeFromSuperview() } } ) Has anyone else experienced this? I've read that others had more success using the center rather than the frame to move the

Swift UIView animateWithDuration completion closure called immediately

孤人 提交于 2020-01-23 05:04:26
问题 I'm expecting the completion closure on this UIView animation to be called after the specified duration, however it appears to be firing immediately... UIView.animateWithDuration( Double(0.2), animations: { self.frame = CGRectMake(0, -self.bounds.height, self.bounds.width, self.bounds.height) }, completion: { finished in if(finished) { self.removeFromSuperview() } } ) Has anyone else experienced this? I've read that others had more success using the center rather than the frame to move the

Swift swipe-able views

北城以北 提交于 2020-01-22 12:48:09
问题 I'm new to Swift and iOS development, and am looking to set up a series of views, or "cards", that can be swiped left and right, with the next/previous cards remaining at the edges to indicate that they are there. This is done in iOS App Store previews: So far all I've really found is this Medium article: iOS Swift: Swipe View. However I'm not sure if this is the right way to do what I'm asking above, and I also don't know how to get the next/previous cards to remain at the edges on each

Swift swipe-able views

蓝咒 提交于 2020-01-22 12:48:07
问题 I'm new to Swift and iOS development, and am looking to set up a series of views, or "cards", that can be swiped left and right, with the next/previous cards remaining at the edges to indicate that they are there. This is done in iOS App Store previews: So far all I've really found is this Medium article: iOS Swift: Swipe View. However I'm not sure if this is the right way to do what I'm asking above, and I also don't know how to get the next/previous cards to remain at the edges on each

Reload tableview inside a UIview

家住魔仙堡 提交于 2020-01-22 03:58:05
问题 My table view is inside a UI View, this has been done writing codes, now i am trying to reload the data in table view but the table view is not refreshing. The UIview and the table view declaration are as follows: @interface { IBOutlet UITableView *tabView; } @property (nonatomic, strong) IBOutlet * tabView @property (nonatomic, strong) UIView * myView; // in .m file 回答1: Provided you have linked up the delegate and the data source methods of the table view correctly, you could just do :

What is the name of this popover class?

徘徊边缘 提交于 2020-01-22 02:06:05
问题 I cannot find the name of the class for this ' popover '. Apple uses it a lot in their applications. I've searched for popover , NSAlert , custom hidden/visible views, and many more. What is it called? 回答1: This is UIAlertController . Before ios7 it is know as UIActionSheet A UIAlertController object displays an alert message to the user. This class replaces the UIActionSheet and UIAlertView classes for displaying alerts. @IBAction func showActionSheetTapped(sender: AnyObject) { //Create the

Change a UIView Frame

眉间皱痕 提交于 2020-01-21 20:10:33
问题 I have set a UIView in my storyboard and make it an outlet. @property (nonatomic, weak) IBOutlet UIView *testView; In the - (void)viewDidLoad method, I want to change its frame like this CGRect frame = self.testView.frame; frame.size.height = 2; self.testView.frame = frame; But it does not work. Anybody can tell me why? 回答1: You might enabled the autolayout in your project , if so the setFrame straightly won't work . Check here for more info Solution : Disable the autolayout, if you don't

IB Designables: Failed to render and update auto layout status for Google Maps

做~自己de王妃 提交于 2020-01-21 06:31:09
问题 I'm using GoogleMaps Pod in my project. I have error in one of my Storyboard: error: IB Designables: Failed to render and update auto layout status for MapViewController: dlopen(GoogleMaps.framework, 1): no suitable image found. Did find: GoogleMaps.framework: mach-o, but wrong filetype I have set view class to GMSMapView: App is working on simulator. How I can fix this error? It causes whole storyboard to be blank. 回答1: Use GMSMapView manually by writing code in simulator; Instead of using

How to set a gradient border on UIView?

拟墨画扇 提交于 2020-01-20 19:42:49
问题 It's very easy to put a simple border on a UIView . You simply link to QuartzCore , import it, and use: self.view.layer.borderColor = [UIColor redColor].CGColor; self.view.layer.borderWidth = 2.0f; My question is... Is there a way to make this border use a gradient. I know how to apply a gradient mask to the entire view, but not just to its border. I'm assuming this could involve a custom view and CoreGraphics drawing inside drawRect: , but I'm not sure where to start. 回答1: I'm not entirely