nslayoutconstraint

position a view in storyboard at 1/3 of screen size

折月煮酒 提交于 2019-12-03 05:25:16
I'm trying to position a view in storyboard to always have it top edge at 1/3 of screen size. I have currently set a constraint to Top Layout Guide, but the constraint's constant is...well it is constant no matter which screen size it is used in, but I want it to be 1/3 of screen size. Can this be done entirely in storyboard? Thanks for answers Screenshot of current state: Create a constraint between the view's top edge and the superview's bottom edge. Set the constraint's constant to zero, and set its multiplier to 1:3. Like this: You can setup it against center or bottom. Here is an example

Animate intrinsicContentSize changes

一个人想着一个人 提交于 2019-12-03 02:10:35
问题 I have a UIView subclass that draws a circle whose radius changes (with nice bouncy animations). The view is deciding the size of the circle. I want this UIView subclass to change its frame size to match the animated changes to the circle radius, and I want these changes to modify any NSLayoutConstraints connected to the view (so that views that are constrained to the edge of the circle will move as the circle resizes). I understand that implementing -(CGSize)intrinsicContentSize and calling

How can I use NSVisualEffectView in window's title bar?

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In OS X Yosemite, Apple introduced a new class NSVisualEffectView . Currently, this class is undocumented, but we can use it in Interface Builder. How can I use NSVisualEffectView in the window's title bar? Here's example: in Safari, when you scroll, the content appears under the toolbar and titlebar with a vibrance and blur effect. 回答1: @sgonzalez's answer forced me to explore NSWindow.h file where i found titlebarAppearsTransparent property. So we get: class BluredWindow: NSWindow { override func awakeFromNib() { let visualEffectView =

How to change the size the UIActivityViewController

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: In my app, I want to share an image, text and url. I do that as follows: UIActivityViewController * controller = [[ UIActivityViewController alloc ] initWithActivityItems :@[ text , url , image ] applicationActivities : nil ]; controller . excludedActivityTypes = @[ UIActivityTypePostToWeibo , //UIActivityTypeMessage, //UIActivityTypeMail, UIActivityTypePrint , UIActivityTypeCopyToPasteboard , UIActivityTypeAssignToContact , UIActivityTypeSaveToCameraRoll , UIActivityTypeAddToReadingList , UIActivityTypePostToFlickr ,

Two views, one below another in portrait and side by side in landscape using layout constraints

落花浮王杯 提交于 2019-12-03 00:32:17
Suppose I have two Text View. In portrait mode, I want these one below another & In landscape mode, I want these to be side by side Is it possible to do that using layout constraints in storyboard using autolayout? If yes, then how? If not, then what would be the other better solution to achieve this. ios6 is my target version Here's how you might go about it in code. Basically you need to: a) configure the appropriate NSLayoutConstraint s for the given orientation in updateViewConstraints in your UIViewController . b) call [self.view setNeedsUpdateConstraints] when the interface rotates.

Enable + Disable Auto-Layout Constraints

雨燕双飞 提交于 2019-12-02 21:55:35
I have a simple (I think) problem: I have a UIImageView , which I have set multiple constraints for in the storyboard. At times, I'll need to disable the constraints, and set its frame manually, but later, I'll want to re-enable those constraints and have the view return to where it was as decided by the constraints. I thought I could do this with something like: @IBOutlet weak var imageView: UIImageView! @IBOutlet weak var constraint: NSLayoutConstraint! func example() { //to set its location and size manually imageView.removeConstraint(constraint) imageView.frame = CGRectMake(...) //to cause

how can i increase the height of an inputAccessoryView

筅森魡賤 提交于 2019-12-02 20:54:30
I have spent several days on this with no solution in sight. I have an inputAccessoryView which consists of a UIView containing a textView and two buttons. The behaviour of the inputAccessoryView is as expected and works fine in all cases except one. When the height of the textView increases, I am trying to increase the height of the inputAccessoryView by the same amount. When I redefine the height of the inputAccessoryView in textViewDidChange , the inputAccessoryView increases height downwards over the keyboard instead of upwards. I have tried many different suggestions from SO but nothing

Autolayout + constraints for dynamic table height based on total rows

烂漫一生 提交于 2019-12-02 18:50:16
问题 First of all this ain't about dynamic cell's height. So don't mix it up. I have a scenario in that I created three cards Detail card: Show specific details for location Chart card: Show different charts based on selection More details card: Card shows more details Below are screens for above cards: View hierarchy for above screens: Controller ScrollView Card-1 Card-2 Card-3 <---- We are interested in this card Custom View TableView So I'm showing the constraints for last card here, all above

Animate intrinsicContentSize changes

限于喜欢 提交于 2019-12-02 17:15:37
I have a UIView subclass that draws a circle whose radius changes (with nice bouncy animations). The view is deciding the size of the circle. I want this UIView subclass to change its frame size to match the animated changes to the circle radius, and I want these changes to modify any NSLayoutConstraints connected to the view (so that views that are constrained to the edge of the circle will move as the circle resizes). I understand that implementing -(CGSize)intrinsicContentSize and calling invalidateIntrinsicContentSize when the radius changes will tell constraints to update, but I cant

How to use NSLayoutConstraint in iOS 6?

和自甴很熟 提交于 2019-12-02 10:16:14
问题 My app should support both iPhone resolutions (5 and older) using iOS 5 and iOS 6. When I use autolayouts in IB, on iOS 5 app crashes like this: link So, I am trying to use NSLayoutConstraint in code, but unsuccessfully yet. Subquestions: I am adding constraints in viewDidLoad method, but is it correct? Does updateViewConstraints invoke by framework? I have never seen that it was invoked. I tried to use examples from apple's docs, but it was without effect to view. Anybody knows how to do it?