uiview

how can I get the scale factor of a UIImageView who's mode is AspectFit?

南楼画角 提交于 2020-01-09 19:14:11
问题 how can I get the scale factor of a UIImageView who's mode is AspectFit? That is, I have a UIImageView with mode AspectFit. The image (square) is scaled to my UIImageView frame which is fine. If I want to get the amount of scale that was used (e.g. 0.78 or whatever) how can I get this directly? I don't want to have to compare say a parent view width to the UIImageView width as the calculation would have to take into account orientation, noting I'm scaling a square image into a rectangular

how can I get the scale factor of a UIImageView who's mode is AspectFit?

随声附和 提交于 2020-01-09 19:13:37
问题 how can I get the scale factor of a UIImageView who's mode is AspectFit? That is, I have a UIImageView with mode AspectFit. The image (square) is scaled to my UIImageView frame which is fine. If I want to get the amount of scale that was used (e.g. 0.78 or whatever) how can I get this directly? I don't want to have to compare say a parent view width to the UIImageView width as the calculation would have to take into account orientation, noting I'm scaling a square image into a rectangular

How do you animate the sublayers of the layer of a UIView during a UIView animation?

不打扰是莪最后的温柔 提交于 2020-01-09 18:23:25
问题 In a UIView animation for a view, you can animate its subviews being laid out by including UIViewAnimationOptionLayoutSubviews in the options parameter of [UIView animateWithDuration:delay:options:animations:completion:] . However, I cannot find a way to animate it laying out its sublayers when they are not some view's backing layer; they would just jump into place to match the new bounds of the view. Since I'm working with layers and not views, it seems like I have to use Core Animation

Putting a UIView or UIWindow above Statusbar

只谈情不闲聊 提交于 2020-01-09 18:22:08
问题 My goal is to draw an invisible button above the status bar on the top of my iPhone app (dimension 320*20 pixels). No matter what I try, something is buggy: For example, I tried to create a new view. When I want to place the view on the top of my app, it always disappears behind the status bar instead of being in front of it! I found another great idea on Stackoverflow: Add UIView Above All Other Views, Including StatusBar Even if a second UIWindow isn't recommended, I tried to implement it.

Test whether a UIView is in the middle of animation

﹥>﹥吖頭↗ 提交于 2020-01-08 21:39:50
问题 Is there any way to tell if a UIView is in the middle of an animation? When I print out the view object while it is moving I notice that there is an "animations" entry: search bar should end editing: <UISearchBar: 0x2e6240; frame = (0 0; 320 88); text = ''; autoresize = W+BM; animations = { position=<CABasicAnimation: 0x6a69c40>; bounds=<CABasicAnimation: 0x6a6d4d0>; }; layer = <CALayer: 0x2e6e00>> When the animation has stopped and I print the view, the "animations" entry is now gone: search

Test whether a UIView is in the middle of animation

喜夏-厌秋 提交于 2020-01-08 21:39:24
问题 Is there any way to tell if a UIView is in the middle of an animation? When I print out the view object while it is moving I notice that there is an "animations" entry: search bar should end editing: <UISearchBar: 0x2e6240; frame = (0 0; 320 88); text = ''; autoresize = W+BM; animations = { position=<CABasicAnimation: 0x6a69c40>; bounds=<CABasicAnimation: 0x6a6d4d0>; }; layer = <CALayer: 0x2e6e00>> When the animation has stopped and I print the view, the "animations" entry is now gone: search

Custom UIView touch area

岁酱吖の 提交于 2020-01-07 05:05:26
问题 Hello I have some weird shapes that I need to handle the touchesBegan method on. The issue is that UIViews are square and the only way I could do it is to maybe declare a grid and then check the coordinates. Is there any other way of doing this? 回答1: Implement hitTest:withEvent: in your UIView subclass. Return YES only if the CGPoint is inside the shape. Check out this question for polygon shapes: How can I determine whether a 2D Point is within a Polygon? 回答2: Also, if you have access this

DidFinishLoading view change

孤人 提交于 2020-01-07 03:19:47
问题 I have a login screen view and 5 tabs in the app.I want when I done with the LoginScreen and it should move to the Tabs views(5) .for this once Login Task is done,I have to remove the view and add the another view controller of the tab..how to do this... - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.viewController = [[ViewController alloc]

iPhone: problem rotating a UIView - doesn't look right

非 Y 不嫁゛ 提交于 2020-01-07 02:32:26
问题 I am adding a simple UIView to my app. This works fine, until I use the 'transform' property to rotate it: myView = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)]; myView.backgroundColor = [UIColor whiteColor]; myView.transform = CGAffineTransformMakeRotation(-0.2); [self.view addSubview:myView]; //self.view is just another generic UIView The added view is rotated, but has jagged edges - i.e. the edges have not been anti-aliased. Here's an example of what I mean: aliased vs. anti

Move UIView up when keyboard appears

吃可爱长大的小学妹 提交于 2020-01-07 02:01:56
问题 Ok so I have gone through almost all questions on SO and tutorials. I am now able to move my UIView up so that it is visible while typing. However the problem is, I want to move the UIView ONLY if the UITextField gets covered by the keyboard, because if it is not, then there is no point in moving the UIView . My code so far: - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name