uiview

How to determine height of the toolbar in UINavigationController?

杀马特。学长 韩版系。学妹 提交于 2021-02-07 05:27:25
问题 I have a view with a toolbar presented by a UINavigationController. When I am handling UIKeyboardWillShowNotification, I'm scrolling the entire screen upwards by the height of the keyboard. The thing is when the keyboard is shown, the bottom toolbar is not, so I need to scroll the screen upwards by only (keyboard.height - toolbar.height). But how to get the height of the toolbar? Thanks 回答1: You just should check the toolbar frame. self.navigationController.toolbar.frame.size.height Of course

UIView flip vertically

和自甴很熟 提交于 2021-02-06 15:10:52
问题 I know it's probably a dummy question, but I have to ask: How to flip a UIView vertically? I'm not asking for doing a animation, but just flip it. I can do vertical flip a UILabel by: label1.layer.transform = CATransform3DMakeRotation(M_PI, 1.0f, 0.0f, 0.0f); and turn it back by: label1.layer.transform = CATransform3DMakeRotation(M_PI, 0.0f, 0.0f, 0.0f); But when I'm doing it to a view: self.view.layer.transform = CATransform3DMakeRotation(M_PI, 1.0f, 0.0f, 0.0f); I think it only rotate half

Smoothly rotate and change size of UIView with shadow

拟墨画扇 提交于 2021-02-05 20:28:28
问题 I have a UIView with a shadow and a UIImageView subview. I want to resize the view when the iPad is rotated and I'm trying to do this in the willRotateToInterfaceOrientation callback. If I set the shadow on the UIView in the basic way the rotation is very choppy; so I'd like some suggestions from others on how to set the shadow setting layer.shadowPath. I have tried animating the frame size change using [UIView animateWithDuration:animations] and setting the new shadowPath in the same block,

Sending Data to UIViewController From UIView Subclass With Delegate

回眸只為那壹抹淺笑 提交于 2021-02-05 08:22:27
问题 I have an IBOutlet-connected UIView object (innerView) sitting over view controller ( UIViewController )'s view. I want to let the user rotate innerView with their finger. So I have a subclass (TouchView) of UIView set to innerView's class. As the user rotates the view object, I want the view controller to receive a value from TouchView. And what I have is the following. // UIView protocol TouchDelegate: class { func degreeChanged(degree: Double) } class TouchView: UIView { weak var delegate:

Swift - adding Subview in AppDelegate

て烟熏妆下的殇ゞ 提交于 2021-01-29 18:55:02
问题 I have a problem with revealingSplashView. I want it to be shown every time the app launches but it is not being displayed because I have to add it as a Subview but how can I do that inside AppDelegate ? I tried this but it is not working: class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? let revealingSplashView = RevealingSplashView(iconImage: UIImage(named: "zauberstab")!, iconInitialSize: CGSize(width: 120, height: 120), backgroundColor: .white) func application

Keeping strong references with dynamic subviews in Swift

北战南征 提交于 2021-01-29 15:27:39
问题 I'm trying to implement a dynamic view composed UI elements sent by the backend, meaning it is not known beforehand how many and which UI elements will be displayed, the server sends JSON containing the types of fields that need to be rendered. So for example the sever sends: type: paragraph type: textfield Then I instantiate a class I have for each of those elements and add their views as subviews to my main dynamic view: class DynamicViewController: UIViewController { // array of subviews,

How to position CAShapeLayer in a UIView

折月煮酒 提交于 2021-01-29 11:46:40
问题 I saw many answers on Stack overflow, but none helped me. I created a DrawView where it's possible to draw. I created an instance of UIBezierPath for drawing. I want to transfer my drawing on a little view (the red one on the image). That's what I did: // This function is called when the user has finished to draw. override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { let shapeLayer = CAShapeLayer() //The CAShapeLayer has the same path of the drawing (currentPath is the

MBProgressHUD with CustomView: Why can't I animate my custom view?

﹥>﹥吖頭↗ 提交于 2021-01-29 09:50:58
问题 This somehow doesn't work...why? How can I achieve a spinning custom propeller without making a gif out of the animation? -(UIView *)propTest { UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 37, 37)]; UIImageView *movablePropeller = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 37 , 37)]; movablePropeller.image = [UIImage imageNamed:@"MovablePropeller"]; [view addSubview:movablePropeller]; movablePropeller.center = view.center; CABasicAnimation *rotation; rotation =

Flutter split and make specific word bold [closed]

蹲街弑〆低调 提交于 2021-01-28 19:09:44
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 10 months ago . Improve this question I have string which is like "Hi @username how are you" I want to change @username text to bold... just @username not whole sentence Example : " Hi @username how are you 回答1: This is a small function that would do that for you then returns a list of widgets. List<Text>

Reload UIView gradient background

≯℡__Kan透↙ 提交于 2021-01-28 18:15:04
问题 I have set my UIView background colour to a CAGradient layer which works well. I am trying to change this gradient within the application when it is running. If i close and reload the app the new gradient is applied but i want this to work during run time. CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = self.backGroundView.bounds; gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor] CGColor], color.CGColor, nil]; [self.backGroundView.layer insertSublayer