uikit

Implementing a gauge control with UIKit on the iPhone

江枫思渺然 提交于 2019-12-30 14:49:22
问题 For an application I'm working on, I'd like to implement sort of a gauge-like control. The gauge should be of vertical orientation and I'd like to get the effect of a dial with the values printed on it to move vertically so that the current value appears at the center of the gauge. While the part of the dial that is not currently visible gets clipped. I thought a good approach would be to have one UIView that acts as the top visible part (the gauge's window if you will) and a subview that

Setting multiple borders on UIView

ぃ、小莉子 提交于 2019-12-30 11:02:21
问题 As I cannot find any questions/answers for this, I imagine it is not possible. Is there anyway to set multiple borders on a UIView . I am currently setting a standard border with .layer.borderWidth and layer.borderColor . I am wondering if I can add a multiple strokes/borders effect to the view. I need a border of 4.0f in white then another 1.0f in another color. 回答1: Three solutions I can think of: nest a UIView in another one, define one border for each; draw the border yourself in -(void

Make NavigationBar's titleView larger than itself

末鹿安然 提交于 2019-12-30 10:58:43
问题 I want to place an image in the middle of a navigation bar that is bigger then the bar itself. So far I tried to use a UIView with a UIImageView inside and it works quite well as you can see here: However as soon as I push another controller and pop back my ImageView gets cropped to the size of the NavigationBar again. Any ideas on how to prevent the cropping? My code so far for iOS 11: override func viewDidLoad() { super.viewDidLoad() let logo = UIImage(named: "Logo") let titleView = UIView

Dismissing modal view controller stack

做~自己de王妃 提交于 2019-12-30 09:49:31
问题 Given the following view controller layout. We build a stack of modal view controllers by first presenting B on A and then presenting C on B . According to the Apple documentation on dismiss(animated:completion:), calling it on A should actually dismiss the topmost view controller ( C in this case) in an animated fashion and all intermediate view controllers without animation. What happens though is that C gets dismissed without animation and B is dismissed in an animated fashion. I put up an

I can't get my head round - (void)playInputClick;

别说谁变了你拦得住时间么 提交于 2019-12-30 09:42:15
问题 I have an inputAccessoryView for a UITextField set up, which is loaded from a XIB when needed (in the exact same way as Apple's KeyboardAccessory example). I'm trying to get the buttons on it to click when pressed using the playInputClick function but I can't work out how. The Apple documentation says that I need to add add a delegate method to the view, but the view was created purely in interface builder so I don't see how I can do this. Does anyone know how to make this work? There seems

Why is -animateWithDuration:delay:options:animations:completion: blocking the UI?

别等时光非礼了梦想. 提交于 2019-12-30 08:42:23
问题 I always thought that Core Animation performs animations on the background. When I run this code, my UI interactions are blocked until the animation finishes: [UIView animateWithDuration:4.5 delay:0 options:options animations:^{ oldView.alpha = 0; newView.alpha = 1; } completion:^(BOOL finished) { if (finished) { [oldView removeFromSuperview]; } }]; Like you can see the duration is long so it's clearly visible that the UI interactions are blocked while animating. The UI interaction begins to

Why is -animateWithDuration:delay:options:animations:completion: blocking the UI?

ぐ巨炮叔叔 提交于 2019-12-30 08:42:08
问题 I always thought that Core Animation performs animations on the background. When I run this code, my UI interactions are blocked until the animation finishes: [UIView animateWithDuration:4.5 delay:0 options:options animations:^{ oldView.alpha = 0; newView.alpha = 1; } completion:^(BOOL finished) { if (finished) { [oldView removeFromSuperview]; } }]; Like you can see the duration is long so it's clearly visible that the UI interactions are blocked while animating. The UI interaction begins to

iPad modal view controller similar to Mail.app?

谁说我不能喝 提交于 2019-12-30 06:48:49
问题 How can I create a modal window in my iPad app similar to the one shown on Apple's website for composing messages in Mail.app? Example: http://dl.getdropbox.com/u/413086/mail_type_20100225.jpg Thanks! 回答1: Just use a normal view controller, assign the modalPresentationStyle property, and present it as a modal view controller. Please read the "iPad Programming Guide" / "Views and View Controllers" for detail. 来源: https://stackoverflow.com/questions/2485015/ipad-modal-view-controller-similar-to

UISplitViewController and complex view hierarchy

霸气de小男生 提交于 2019-12-30 03:14:10
问题 I'm doing an iPad tech demo and I'm running into a serious technical problem. I have an app concept that leverages UISplitViewController, but NOT as the primary controller for the entire app. The app flow could be described roughly as this: Home screen (UIViewController) List->Detail "Catalog" (UISplitViewController) Super Detail Screen (UIViewController but could conceivable also be a child of SplitView). The problem is in the flow between Home and Catalog. Once a UISplitViewController view

Adding Emboss to a UILabel in a navigationItem.titleView (as seen with navigationItem.title)

亡梦爱人 提交于 2019-12-30 01:39:05
问题 I'm trying to mimic the default emboss that automatically gets applied to navigationItem.title, as well as many other UIKit controls. As seen in this screenshot's title ("Table Cells"): Emboss title http://quicksnapper.com/files/3440/192219267049D92BB23DE74.png I'm essentially trying to add 2 UILabels to the navigationItem.titleView, however the UILabels just show up as flatly drawn and it really just doesn't feel/look right :P I've thought about playing with shadows, but that would only give