uiview

how to make dynamical strokeColor in CAShapeLayer? In Swift

十年热恋 提交于 2020-01-16 03:01:09
问题 I use six parameters (as active, inactive, wired, compressed, free and total). I make a class of CAShapeLayer and I made one function in there with help I can draw circle just add parameters. I make CGPath and add it six once in function which draw a circle. I get the 5 layers to UIView . I make timer which update data in one second but it add else 5 layer to UIView . It is wrong way. I want to animate arcs with data and update in one second. when layers become too much device is working

How to change a UITouch's location before passing to the next responder

冷暖自知 提交于 2020-01-15 11:42:53
问题 I have a parent UIView and a child UIView, I wanna let a touch pass through from child to parent, and handled by the two views. y-------------- | parent | | x------ | | |child| | | |_____| | |_____________| So in the child view, I override: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // child touch handle // ... // parent touch handle [self.nextResponder touchesBegan:touches withEvent:event]; } but when I touch the `x` in child, it forwarded to `y` in parent (relative

UIView drawRect; class variables out of scope

人走茶凉 提交于 2020-01-15 10:54:53
问题 Short & sweet version of my last question in light of new information. I have a UIVIew with an init and a drawrect method (and another thread and a bunch of other stuff, but I'll keep it short & sweet). All of the class variables that I alloc and init in the -(id)init method are out of scope/nil/0x0 in the drawRect method, and I am unable to access them. For example; In the interface: NSObject* fred; In the implementation: -(id)init { if(self == [super init]) { fred = [[NSObject alloc] init];

UIView drawRect; class variables out of scope

大城市里の小女人 提交于 2020-01-15 10:52:31
问题 Short & sweet version of my last question in light of new information. I have a UIVIew with an init and a drawrect method (and another thread and a bunch of other stuff, but I'll keep it short & sweet). All of the class variables that I alloc and init in the -(id)init method are out of scope/nil/0x0 in the drawRect method, and I am unable to access them. For example; In the interface: NSObject* fred; In the implementation: -(id)init { if(self == [super init]) { fred = [[NSObject alloc] init];

Weird UIView coordinate issue

99封情书 提交于 2020-01-15 08:14:13
问题 I am writing a universal application. As a result I have set it up so that my XIB/NIBs are not created with the view controllers, but are created separately and then linked to the view controller by setting the Class Name on the XIB to that of the appropriate view controller (and linking the view on File's Owner to the view on the XIB). I then load the appropriate XIB/NIB (iPhone or iPad) when the view controller is initialized, like so: SomeViewController *vc = [[SomeViewController alloc]

How to stop UIView Animation when needed?

非 Y 不嫁゛ 提交于 2020-01-15 05:24:29
问题 I have this Code: -(void)animationLoop{ CGPoint oldPoint = CGPointMake(myCircleUIView.frame.origin.x, myCircleUIView.frame.origin.y); [UIView animateWithDuration:1.0 animations: ^{ myCircleUIView.frame = CGRectMake(myCircleUIView.frame.origin.x + [self randomFloatingGenerator], myCircleUIView.frame.origin.y + [self randomFloatingGenerator], myCircleUIView.frame.size.width, myCircleUIView.frame.size.height); } completion: ^(BOOL finished) { [UIView animateWithDuration:1.0 animations:^{

In Swift, how do I animate a UIView with auto-layout like a page sliding in?

纵饮孤独 提交于 2020-01-15 03:57:05
问题 I try to create a UIView that is representing a page whose size is the same as the device screen. Since the app supports orientation, I am using AutoLayout to construct it. It works fine until I try to animate the page to slide in from the right. Here is the best I could come up with after some research: myView = UIView() myView.backgroundColor = UIColor.orangeColor() parentView.addSubview(myView) myView.translatesAutoresizingMaskIntoConstraints = false myView.leftAnchor

Solid Shadow in All Directions

坚强是说给别人听的谎言 提交于 2020-01-15 03:55:10
问题 I've been looking for a way to set the shadow property of a layer, like this: where the light blue is the layer—the UIImageView in this instance—and the dark blue is the shadow. I'd like the shadow to do things: Appear on all four sides: accomplished by setting shadowOffset to CGSizeMake(0.0, 0.0) and making shadowRadius nonzero Be entirely opaque: accomplished by setting shadowOffset to a specific point in the layer and shadowRadius to zero I already have shadowOpacity set to zero, but I can

Begin UIPanGesture Event From A Pressed State At Time Of Instantiation

ぐ巨炮叔叔 提交于 2020-01-14 22:53:16
问题 Is there a way to begin a UIPanGestureEvent if the finger is already pressed at the time the object is instantiated? I have a situation where when a user holds their find on a screen I create a UIView under their finger. I want them to be able to drag that around and as such I have put a UIPanGestureRecognizer inside the UIView. Problem is I need to take my finger off and put it back to trigger the UIPanGestureRecognizer to start up. I need it to start from an already pressed state. Do you

Begin UIPanGesture Event From A Pressed State At Time Of Instantiation

早过忘川 提交于 2020-01-14 22:52:57
问题 Is there a way to begin a UIPanGestureEvent if the finger is already pressed at the time the object is instantiated? I have a situation where when a user holds their find on a screen I create a UIView under their finger. I want them to be able to drag that around and as such I have put a UIPanGestureRecognizer inside the UIView. Problem is I need to take my finger off and put it back to trigger the UIPanGestureRecognizer to start up. I need it to start from an already pressed state. Do you