uiview

How to make a UIDatePicker appear at bottom of screen?

元气小坏坏 提交于 2020-01-13 04:12:11
问题 I currently use MonoTouch with MonoTouch.Dialog. When tapping on a date field it pushes the navigationcontroller so you go right a screen to see your UIDatePicker where you choose the date then go "back" to the main screen again. I'd really like to have this UI like other apps I've used that when you select a date field the UIDatePicker appears at the bottom of the current screen. I would like to learn how to do this and apply it to other input fields where I may want to use a custom picker

drawing with clear color on UIView (cutting a hole) in static method

▼魔方 西西 提交于 2020-01-12 23:12:09
问题 I have an iPhone application and I need to implement the following method: +(UITextView *)textView:(UITextView *) withCuttedRect:(CGRect)r This method must cut (fill with [UIColor clearColor] ) the rect r from UITextView and return UITextView object. The user will see the view behind UITextView from the cutted holes. How can it be done? 回答1: When you would have something like: +(UITextView *)textView:(UITextView *)textView withCuttedRect:(CGRect)r { } you actually can simply access the

Resize UIView to fit a CGPath

做~自己de王妃 提交于 2020-01-12 09:55:46
问题 I have a UIView subclass on which the user can add a random CGPath. The CGPath is added by processing UIPanGestures. I would like to resize the UIView to the minimal rect possible that contains the CGPath. In my UIView subclass, I have overridden sizeThatFits to return the minimal size as such: - (CGSize) sizeThatFits:(CGSize)size { CGRect box = CGPathGetBoundingBox(sigPath); return box.size; } This works as expected and the UIView is resized to the value returned, but the CGPath is also

Resize UIView to fit a CGPath

你离开我真会死。 提交于 2020-01-12 09:50:37
问题 I have a UIView subclass on which the user can add a random CGPath. The CGPath is added by processing UIPanGestures. I would like to resize the UIView to the minimal rect possible that contains the CGPath. In my UIView subclass, I have overridden sizeThatFits to return the minimal size as such: - (CGSize) sizeThatFits:(CGSize)size { CGRect box = CGPathGetBoundingBox(sigPath); return box.size; } This works as expected and the UIView is resized to the value returned, but the CGPath is also

Load custom UIView with XIB from a View Controller's view using IB

China☆狼群 提交于 2020-01-12 07:58:30
问题 I have a custom UIView ( MyCustomUIView ) which is built using Interface Builder. I'd like to place this custom view in MyViewController 's view, which is also designed using IB. I've placed an UIView as a subview in MyViewController 's XIB and set it's class to MyCustomUIView . The problem is, when I run the code, only a blank view appears. (When I instantiate MyCustomUIView in code, it displays well.) I'm only overriding the initWithFrame: method the following way in MyCustomUIView.m : -

Disabling animation when changing layer/view properties?

半城伤御伤魂 提交于 2020-01-12 07:19:17
问题 I composed a kind of animation by adding several layers to a UIView. Those layers shall be set visible or invisible by a script. The script is based on objects that implement a protocol: // the general protocol for a step @protocol ActionStep -(void) applyForTime:(int)playtime; -(void) reset; @end an in a timer I iterate through the step objects: NSEnumerator* enumerator = [ScriptObjects objectEnumerator]; id obj; while ( obj = [enumerator nextObject] ) { id <ActionStep> step = obj; [step

How do you create a semi-transparent background for a UIView?

▼魔方 西西 提交于 2020-01-12 06:45:11
问题 I am creating a UIView containing some text that partially covers a UIImageView. I want the user to be able to read the text and still maintain a perspective on the image underneath. I have tried setting the background color to [UIColor clearColor], but then the background is totally transparent and it is hard to read the text depending upon the image colors. If I lower the view.alpha=0.5 the whole view including the text is partially transparent. What I'd like is to maintain the text and

A better way to animate resizing of UIView and subviews?

半世苍凉 提交于 2020-01-12 05:13:27
问题 Example screen capture: What is a better way to animate the resizing of a UIView that includes subviews? My current method: In the screen capture, the parent UIView (orange) has a subview UILabel (yellow + autoresizing). animateWithDuration is animating the resizing of the parent UIView's frame. The problem with this method is it does not animate the resizing of the subview. It abruptly changes, where it should scale animatedly. Is explicitly animating the subview best, or is there a more

iOS Storyboard: Views outside of the ViewController and on Top of the Scene (between First Responder and Exit boxes)

久未见 提交于 2020-01-12 04:34:32
问题 I am having a hard time understanding why you can put UIViews outside the UIViewController on the storyboard, and what the use case of it might be. For instance, on the storyboard I can add UIToolbar , UIAcitivtyIndicator and UIProgressView that is outside of the UIViewController . Is this mean there is a way for you to reference those Views that are outside UIViewController and potentially display them somehow either programmatically or embed those like you would do with a ContainerView ?

How do I animate a UIView along a circular path?

心不动则不痛 提交于 2020-01-12 03:54:09
问题 In Swift code, how can I start and animate a UIView so that it moves in a motion along a circular path, then bring it to an end gracefully? Is it possible to achieve this using a CGAffineTransform animation? I have prepared a GIF below showing the type of animation I'm trying to achieve. 回答1: Updated: Update code to Swift 4. Use #keyPath rather than string literal for keyPath . Use UIBezierPath and CAKeyFrameAnimation . Here is the code: let circlePath = UIBezierPath(arcCenter: view.center,