uiview

Shadow UIview and clipsToBounds

£可爱£侵袭症+ 提交于 2020-01-14 11:25:42
问题 I would like to set the shadow to my container UIView. I use this code to make it: - (id)initWithCoder:(NSCoder*)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { //-> drop shadow [self.layer setShadowColor:[UIColor blackColor].CGColor]; [self.layer setShadowOpacity:0.6]; [self.layer setShadowRadius:2.0]; [self.layer setShadowOffset:CGSizeMake(2.0, 2.0)]; } return self; } This works well. But, when I use _containerView.clipsToBounds = YES; on this container UIView, I can't see my

Interface builder agent crashes when accessing @IBInspectable UIImage

夙愿已清 提交于 2020-01-14 10:33:12
问题 I'm implementing a custom view by subclassing UIView and using @IBInspectable for some of my variables. Two of them are UIImage. If I try to access one of them in the code, the interface builder crashes with the following message: file:///PathToMyProject/MyProject/Pod/Classes/UI/View/MyView.xib: error: IB Designables: Failed to update auto layout status: The agent crashed and file:///PathToMyProject/MyProject/Pod/Classes/UI/View/MyView.xib: error: IB Designables: Failed to render instance of

Disable scrolling via IBAction contained in subview

我只是一个虾纸丫 提交于 2020-01-14 06:27:07
问题 My iPad app is currently built as such: xml data is pulled from my website and parsed in a View Controller "FishIDView". This view controller has a UIScrollView "scrollView" that has a subview "XMLView" which is a UIView. scrollView is setup so that it scrolls and pages through the XMLViews based on the number of items contained in the XML. For example 12 items = 12 pages, or instances of XMLView. These pages contain photos of individual fish. Each of these pages contain a button that creates

Navigation bar same bg color as view

笑着哭i 提交于 2020-01-14 06:00:14
问题 Our designer wants the navigation bar to have the same background color as the view's. However, they also want the navigation bar to remain translucent. Obviously if I set it to non-translucent it works a treat: [[UINavigationBar appearance] setTranslucent:NO]; But that is not the desired effect. Is there a way I can make them the same color without spending hours tweaking the background color of the navigation bar? This is what it looks like when we set the navigation and view to the same

UIViewControllerAnimatedTransitioning: Black screen fragments after rotation change

白昼怎懂夜的黑 提交于 2020-01-14 03:44:10
问题 I have created a Viewcontrollertransition and everything is working as long as I don't change the device orientation. Image 1 shows the screen as it should be. I then switch to the next viewcontroller where I change the orientation. Now I go back to first viewcontroller and again switch the orientation. Then I get the result visible in image 2. A black border appears. Please don't mind the white box in the center of the screen. Below you find the code of my animation. Can you see what is

UIView layer's sublayers display differently/randomly each time view appears

限于喜欢 提交于 2020-01-14 03:43:09
问题 I have a simple custom CALayer to create an overlaying gradient effect on my UIView. Here is the code: class GradientLayer: CALayer { var locations: [CGFloat]? var origin: CGPoint? var radius: CGFloat? var color: CGColor? convenience init(view: UIView, locations: [CGFloat]?, origin: CGPoint?, radius: CGFloat?, color: UIColor?) { self.init() self.locations = locations self.origin = origin self.radius = radius self.color = color?.CGColor self.frame = view.bounds } override func drawInContext

Archive the uiview controls (uiimageview,uiscrollview,uitableview,uibutton)

与世无争的帅哥 提交于 2020-01-14 03:37:09
问题 Am archive and unarchive the uiview and display the view in ipad this controls (uiimageview,uiscrollview,uitableview,uibutton) were not displayed....but uiview subviews all controls are there ....Is it possible to get that controls(uiimageview,uiscrollview,uitableview,uibutton) in view? possible means how to get that controls to display in view. uiview *viewForArchive; uiview *newCir=[uiview alloc ]initwithframe:cgrectmake(0,0,768,1024)]; //archiving NSMutableData *d= [NSMutableData data];

'ContentMode' is not a member type of 'UIView'

╄→гoц情女王★ 提交于 2020-01-14 03:34:29
问题 I have the following piece of code which works well for a legacy IOS app, but now no longer works in xcode 9: The error I'm getting is: 'ContentMode' is not a member type of 'UIView' Here is the code: import Foundation struct ImageViewLayout { static func frameForImageWithSize(_ image: CGSize, previousFrame: CGRect, inContainerWithSize container: CGSize, usingContentMode contentMode: UIView.ContentMode) -> CGRect { let size = sizeForImage(image, previousSize: previousFrame.size, container:

Moving UIView with a for loop

徘徊边缘 提交于 2020-01-14 03:34:08
问题 I am trying to move a UIView, which is small. My for loop just moves the UIView down 100 points. This works except it doesn't move until the loop is finished. I have tried setting [self.view setNeedsDisplay] and [myView setNeedsDisplay], I have also put the function inside nstimer and nsthread, like seen below [NSThread detachNewThreadSelector:@selector(doStuff) toTarget:self withObject:nil]; and [NSTimer scheduledTimerWithTimeInterval:1/15 target:self selector:@selector(doStuff) userInfo:nil

Cant interact with custom infowindow in google map

半腔热情 提交于 2020-01-14 03:29:14
问题 I have a google map and I've created a custom info window for my markers. I've put a couple buttons on the window, but I can't interact with them for the life of me. Here is my custom view: class MarkerWindowView: UIView, UIGestureRecognizerDelegate { //@IBOutlet weak var thumbNail: UIImageView! @IBOutlet weak var userName: UILabel! @IBOutlet weak var videoLocation: UILabel! @IBOutlet weak var tags: UILabel! override func awakeFromNib() { println("awake From Nib") self.userInteractionEnabled