uiimageview

drag and drop uiimage into another uiimageview

孤人 提交于 2019-12-05 10:14:34
I am using following code snippet to drag and drop uiimageview UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)]; [panRecognizer setMinimumNumberOfTouches:1]; [panRecognizer setMaximumNumberOfTouches:1]; [panRecognizer setDelegate:self]; [myImageView addGestureRecognizer:panRecognizer]; -(void)move:(id)sender { CGPoint translatedPoint = [(UIPanGestureRecognizer*)sender translationInView:self.view]; if([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateBegan) { firstX = [myImageView center].x; firstY =

How to get Google Map's 'myLocationEnabled' blue dot always on top

别来无恙 提交于 2019-12-05 10:09:48
This is an example of a UIImageView inside of a GMSMapView. My problem is that Google's blue dot is showing behind the UIImageView...How can I get this blue dot for myLocationEnabled to always show on top? @IBOutlet weak var mapView: GMSMapView! func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus){ NSLog("Did Change Authorization Status") if status == CLAuthorizationStatus.AuthorizedWhenInUse { //This uses the location manager if locationManager.location != nil { currentLatitude = locationManager.location.coordinate.latitude

Remove alpha channel from UIImage

瘦欲@ 提交于 2019-12-05 09:59:36
I use the following method to get a decompressed uiimage from file system. However the UIImageView is colored as red when I turn on the color blended layer, even though the UIImageView is set to Opaque. The images on file system don't have alpha channel. I tried set CGContextSetAlpha(bitmapContext, 1), but still has blended layer. Anyone know how to remove alpha channel when using CGContextDrawImage? - (UIImage *)decompressedImage { CGImageRef imageRef = self.CGImage; CGRect rect = CGRectMake(0.f, 0.f, CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); CGContextRef bitmapContext =

how to set the UIImageView align left or right when set the contentMode to UIViewContentModeScaleAspectFit?

限于喜欢 提交于 2019-12-05 09:53:56
问题 I want to control the image alignment when using the UIViewContentModeScaleAspectFit in UIImageView . For example, I have two UIImageView in one view as above.these two UIImageView 's contentMode is UIViewContentModeScaleAspectFit . Now I want to set image 3 to align right and image 4 to align left, so that these two images can be together. I try to set the contentMode to UIViewContentModeScaleAspect|UIViewContentModeLeft , but it make things worse. Any suggestions are appreciated. 回答1:

Setting UIImageView image affects layout constraints

谁说胖子不能爱 提交于 2019-12-05 09:30:21
I am creation a simple UIImageView with the following constraints: self.view.addConstraint(imageView.topAnchor.constraint(equalTo: contentLayoutGuide.topAnchor)) self.view.addConstraint(imageView.centerXAnchor.constraint(equalTo: contentLayoutGuide.centerXAnchor)) self.view.addConstraint(imageView.heightAnchor.constraint(equalTo: contentLayoutGuide.heightAnchor)) self.view.addConstraint(imageView.widthAnchor.constraint(equalTo: contentLayoutGuide.heightAnchor)) The important one is the last one, which sets the width equal to the height of the image view and the height of the image view is

Center UIImageView inside UIScrollView without contentInset?

一曲冷凌霜 提交于 2019-12-05 08:51:48
I have been unable to find the answer for this issue I am having. I have a UIImageView inside a UIScrollView, and I would like the center its content vertically. Right now, the only way I have been able to do this is by setting the scroll view's contentInset based on the height of the UIImageView size, but this is not a perfect solution; it just increases the size of the UIImageView, making the UIScrollView 'think' its content is bigger, and adds these black bars to the top. I've tried to get help from: UIScrollView with centered UIImageView, like Photos app and Center content of UIScrollView

UIScrollView with background image

风流意气都作罢 提交于 2019-12-05 08:47:48
I want to have a background image behind a UIScrollView area. That part's easy. The issue I'm running into is I don't want the image to move. I want it to fill the screen and then the scrolling just happens over that without effecting the image in anyway. I've looked through lots of other postings on similar topics, but can't seem to get anything to work. When I do the following, the background scrolls: CGRect fullScreenRect = [[UIScreen mainScreen] applicationFrame]; UISCrollView *scrollView = [[UIScrollView alloc] initWithFrame:fullScreenRect]; scrollView.backgroundColor = [UIColor

iOS 8 - AutoLayout issue - UIImageView inside UITableViewCell ignoring width constraints

不想你离开。 提交于 2019-12-05 08:11:21
I have a problem with iOS 8 autolayout . I want to have a custom UITableviewCell with a UILabel and 5 UIImageView . I want the images to be shown in landscape-mode but not in portrait mode, because then the UILabel would be squeezed to narrow. I designed the view in interface builder and added the following constraints (among others): 1. priority 1000: Label width >= 120px 2. priority 1000: ImageView[1..5] horizontal space to next one = 0px (to align them next to each other, the rightmost image view got horizontal space = 0 to content view to align them to the right side) 3. priority 999:

Unable to show a *.gif file in a UIImageView in swift

自作多情 提交于 2019-12-05 07:51:58
I have a *.gif file that I want to show in a UIImageView . I have tried the library FLAnimatedImage , code below. Result is just a static image. class LoginVC: UIViewController, UITextFieldDelegate { @IBOutlet weak var img_popup: FLAnimatedImageView! var img_popupraw: FLAnimatedImage = FLAnimatedImage(animatedGIFData: NSData(contentsOfFile: "ShitTalk_LoadingAnimation.gif")) override func viewDidLoad() { img_popup.animatedImage = img_popupraw } } Open to any alternative ways to show animating gif directly from a gif file. I am using Swift. I strongly recommend you to use SwiftGif . Import the

Create UIImage from a UIImageView

孤者浪人 提交于 2019-12-05 07:12:44
问题 I create a UIImageView with two UILabel as subviews of it: UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, [[UIScreen mainScreen] bounds].size.height)]; img.backgroundColor=self.view.backgroundColor; UILabel *textOne=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, 290, 250)]; textOne.text=_textOneLabel.text; textOne.textColor=_textOneLabel.textColor; UILabel *textTwo = [[UILabel alloc] initWithFrame:CGRectMake(100,180,200,100)]; textTwo.text=_textTwoLabel.text;