uiimageview

Tiling a UIImageView using resizeableImageWithCapInsets:resizingMode?

核能气质少年 提交于 2020-01-23 20:01:59
问题 I'm using the following code to try to create a tiled image with cap insets, and seeing the image below as the results in the simulator. My source image is 145x83 pixels in size, and shown here too. What am I doing wrong? SOURCE IMAGE: RESULTS IN SIMULATOR: CODE: - (void)viewDidLoad { [super viewDidLoad]; UIImage *cloudImage = [UIImage imageNamed: @"cloud.png"]; [cloudImage resizableImageWithCapInsets: UIEdgeInsetsMake(10, 10, 10, 10) resizingMode: UIImageResizingModeTile]; UIImageView

Center UIImageView inside UIScrollView without contentInset?

徘徊边缘 提交于 2020-01-23 06:58:26
问题 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

Center UIImageView inside UIScrollView without contentInset?

∥☆過路亽.° 提交于 2020-01-23 06:58:23
问题 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

Preview rounded image in iphone

こ雲淡風輕ζ 提交于 2020-01-23 00:36:09
问题 can anyone tell me how can I create an image preview inside a customized cell with the aspect of the ones loaded in the mms'. I've been trying to do it by changing values in IB and I haven't been able to. Thanks a lot! (source: iphonehelp.in) Thanks for the three answers. Doing cell3.imageView.layer.masksToBounds = YES; cell3.imageView.layer.cornerRadius = 16; cell3.imageView.layer.borderColor = [UIColor lightGrayColor].CGColor; cell3.imageView.layer.borderWidth = 1.0; I was able to do part

UIScrollView with scaled UIImageView using autolayout

别来无恙 提交于 2020-01-22 17:48:06
问题 Consider a UIScrollView with a single subview. The subview is an UIImageView with the following size constraints: Its height must be equal to the height of the UIScrollView . Its width must be the width of the image scaled proportionally to the height of the UIImageView . It is expected that the width of the UIImageView will be bigger than the width of the UIScrollView, hence the need for scrolling. The image might be set during viewDidLoad (if cached) or asynchronously. How do you implement

iPhone - save UIImageView state

一个人想着一个人 提交于 2020-01-21 09:26:52
问题 I have created a subclass of UIImageView and I am handling the touches for its objects inside the subclass itself. Now when the user is about to exit the app I want to save the state of the images. And as there are multiple transforms which might have taken place on the images (I am saving all the transforms in an array), I want to be able to save these objects in applicationWillTerminate. Is there any way I can save these objects? Or do I have to save everything individually? If I do, how do

Trying to save image to Photo album with custom name in iOS

柔情痞子 提交于 2020-01-20 07:59:09
问题 I have an iOS application where I am saving an image to my photos folder to my iPad. However, what I would like to do is store the image with a custom name (e.g. using the date and time stamp for when the image was actually captured), so that it would be easier for it to be retrieved in the future. My code at the moment for storing my images is as follows: - (IBAction)imageCapture:(id)sender { UIImage *myImage = [_imageView currentImage]; UIImageWriteToSavedPhotosAlbum(myImage, nil, nil, nil)

Masking UIView/UIImageView to cutout transparent text

笑着哭i 提交于 2020-01-20 04:56:47
问题 How can I mask an UIView or UIImageView so that a text is cutout from it? I googled a lot and it seems that many people struggled the same. Most irritating I always tried to invert the alpha of a snapshotted view to get the result. What I want looks like this: 回答1: This is the custom mask label. import UIKit final class MaskLabel: UILabel { // MARK: - IBInspectoable @IBInspectable var cornerRadius: CGFloat { get { return self.layer.cornerRadius } set { self.layer.cornerRadius = newValue } }

iOS swift imageView cannot be hidden in TableViewCell

半腔热情 提交于 2020-01-17 06:12:31
问题 I recently added some swift code inside an objective-C project and I am facing something strange I cannot sort out. I am using the Searchbar (from Ray tutorial) that I customized. In the cellForRowAtIndexPath method, I can customize my cell labels and everything works fine. The only thing is that I cannot hide some imageViews according to if (BOOL) conditions. Something must be wrong with my swift code since I can hide those image in Objective-C files with the same if (BOOL) conditions. Just

Pick a random UI Image View - Swift 2

梦想与她 提交于 2020-01-17 05:03:11
问题 So I have 3 images @IBOutlet weak var imageOne: UIImageView! @IBOutlet weak var imageThree: UIImageView! @IBOutlet weak var imageTwo: UIImageView! I generate a random image from an array of images, the random image generated is the "correct" image Here is how I was currently doing it let randomIndex = Int(arc4random_uniform(UInt32(famousPeople.count))) let correct = famousPeople[randomIndex] self.imageOne.image = UIImage(named: correct) Obviously the issue with this is the imageOne is always