uiimageview

Can't change UIImageView image in function (SWIFT)

雨燕双飞 提交于 2019-12-04 07:11:29
问题 I have called this function after it is declared and everything works but the UIImageViews don't change their image. I would be very grateful for your help. 回答1: I think that the problem is the sleep(3), this line block the main thread. Instead of that use: DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { // your code here } Apple Reference Note: For the most part, use UIKit classes only from your app’s main thread. This is particularly true for classes derived from UIResponder or that

How to Move Left and Righ of when people flip UIImageView so it looks like it's really going left and right

烂漫一生 提交于 2019-12-04 07:04:59
问题 The style should be like iBooks or pictures in foursquare. When we flip to the left we see the next picture being pulled. How to do so? Is there a code to do so? I think there must have been a ready code for that 回答1: Try this. One solution. Revise as needed. Create a new project of type Single View Application, name it BookEffect, uncheck Use Storyboards, uncheck Include Unit Tests, but be sure to check the option Use Automatic Reference Counting. Then add to the project a few pictures, for

How to detect objects from Image Processing in iOS?

那年仲夏 提交于 2019-12-04 06:51:17
问题 I have a image and the image have in it A glass a cup , two spoon. This image is showing on the iPad. Now I want when user touch the spoon only, the spoon color will become green rest of the image remain same. I have no Idea how to do this? And where to start? Any Idea or suggestions would be highly welcome. 回答1: Use CALayer, create CALayer with needed frame and add its to ImageView. CALayer documentation:CALayer Class Reference 来源: https://stackoverflow.com/questions/16355878/how-to-detect

How to do a motion blur effect on an UIImageView in Monotouch?

穿精又带淫゛_ 提交于 2019-12-04 06:41:35
问题 What's the way to do a realtime motion blur in MonoTouch? I need to apply a motion blur effect on an UIImageView when scrolling an inertial picture gallery, with strength and direction as parameters, as in Photoshop. I can't find any blur or motion blur filter in CocoaTouch or in CoreAnimation or anywhere in the iOS SDK. Is there some 2D effects library usable from MonoTouch with realtime blur filters that are good for the iPhone? Thanks in advance. 回答1: I've found a good open source library

Stack View ScaleAspectFit Mask Resize in Swift

走远了吗. 提交于 2019-12-04 06:35:37
问题 I am masking an image within a stack view and for some odd reason, my mask is not aligning/resizing correctly with the image. Here is a demonstration of what's occurring as I'm dynamically adding instances of this image in a stack view while each subview is resized within its boundaries and spacing. As you can see, the mask retains the original size of the image and not the resized version. I've tried many different width & height variations including the bounds.width, layer.frame.width,

Can't access UIImageView if created programmatically

♀尐吖头ヾ 提交于 2019-12-04 05:55:29
问题 If I create a UIImageView via Storyboard and add it as a @property into a ViewController.h , I can access that UIImageView from anywhere in the ViewController.m via [self UIImageView] or self.UIImageView . But If I create the UIImageView programmatically from viewDidLoad as you see below, I seem to lose the ability to access it from outside viewDidLoad . UIImageView *prevImgView = [[UIImageView alloc] init]; UIImageView *currImgView = [[UIImageView alloc] init]; UIImageView *nextImgView = [

Mask a view in Objective-C

▼魔方 西西 提交于 2019-12-04 05:12:41
In ActionScript 3 we can apply a mask of to a visual object like this: SomeVisualObject.mask = maskShapeObject; How can I achieve similar result in Objective-C ? Assume I have two UIImageView objects, I want something like this: imageView1.mask = imageView2; How can I use one UIImageView to mask, or clip the shape of, another? CALayer *maskLayer = [CALayer layer]; UIImage *maskImage = [UIImage imageNamed:@"maskImage.png"]; maskLayer.contents = (id)maskImage.CGImage; maskLayer.bounds = (CGRect){CGPointZero, maskImage.size}; UIImageView *imageViewToMask = [[UIImageView alloc] initWithFrame

Need help about contentMode and autoresizingMask of UIImageView

試著忘記壹切 提交于 2019-12-04 05:10:43
i have picture like this image it will present on Landscape Mode so if rotate device to Portrait, how to present image like this Use an UIImageView with these settings: imageView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); imageView.contentMode = UIViewContentModeScaleAspectFit; It looks like what you're trying to do is clip the image on the right, while leaving the top, left, and bottom the same. Two things to try: 1) Subclass UIView and in the drawRect method, adjust the rect and draw out the clipped image using CGContextDrawImage (context, rect,

TouchesMoved with Button?

自古美人都是妖i 提交于 2019-12-04 05:03:10
问题 Is it possible to use the touchesMoved function with buttons instead of UIImageView s? 回答1: Yes. In your .h file IBOutlet UIButton *aButton; In your .m file -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event touchesForView:self.view] anyObject]; CGPoint location = [touch locationInView:touch.view]; if(CGRectContainsPoint(p1.frame, location)) { if (!p1.isHighlighted){ [self pP01]; [p1 setHighlighted:YES]; } }else { [p1 setHighlighted:NO]; } // if

UIImageView Mask Layer not coming from corners Until Scroll PageViewController First time

元气小坏坏 提交于 2019-12-04 05:03:09
问题 I want to achieve this result So I need to add mask at bottom but Here What I got Code I have tried private func setupImageCutPath () { let path = UIBezierPath() path.move(to: .zero) path.addLine(to: CGPoint(x: 0 , y: self.imgView.frame.height)) path.addLine(to: CGPoint(x: self.imgView.frame.width , y: self.imgView.frame.height - imageCutAwayPart)) path.addLine(to: CGPoint(x: self.imgView.frame.width, y: 0)) // Multiple tried to check from where masking is comming self.maskLayer.fillColor =