FAQ Database Discussion Community


Setting layer out of layer in UIbutton?

ios,objective-c,uibutton,uiimage,calayer
i want this type of button i have tried pictureBtn which is UIbutton ,i gave it a 5 pixel clear color corner radius and add a picture like camera below but last outer white line how to deal with this can anybody have ideas or something like control. ...

How to make an image fade out by itself in a few seconds?

ios,objective-c,image,uiimage,fadeout
i got a button to show an image in the UIImageView. what i need to do is to get this image to fade out by itself in 2 seconds, is it possible to do so? here is my code on the button: - (IBAction)A { UIImage *Img = [UIImage imageNamed:@"AString.png"];...

base64 encoded image and add it to UIImage

ios,xcode,uiimage,nsdata
I am creating a captcha image as client needs. I am getting JSON for the image with two key values. key: CaptchaText, value: uEU3VNWh0lndY8UyL+jWsQ== key: CaptchaImage, value:...

Getting generated video to next view and saving it to Camera roll in iOS

ios,video,uiimage
Here I need to generate video with multiple images picked,music selected.In this I can pick multiple images and generate video to those images By saving selected images in an array and generating video.But my issue is, generated video should present in next view and also it should be saved in...

When didDeselect a Custom Cell the image doesn't change on iOS

objective-c,iphone,uitableview,checkbox,uiimage
Im working with a UITableView that has a Custom Cell. The Custom Cell only has a Label and a UIImage, the UIImage will be used as a checkbox. So the problem is that once I click a row the checkbox image changes to a checkmark png image (which is ok)...

How do you build an NSURL for an image in Image.xcassets?

ios,uiimageview,uiimage,uikit
The easiest way to load a local UIImage asset is of course to use +[UIImage imageNamed] but for my case, I want to supply a NSURL *. How do I get a NSURL * for local file?

Convert data to an UIImageView

parse.com,uiimage,nsdata
I try to convert data from parse.com into my UIImageView. for (PFObject *object in objects) { PFFile *file = [object objectForKey:@"imageData"]; [file getDataInBackgroundWithBlock:^(NSData *data, NSError *error) { [contentImageArray addObject: [UIImage imageWithData:data]]; }]; } I load my data in a NSMutableArray, this still works, but then I want my data in...

swift - navigation controller remove back button arrow

ios,xcode,swift,uinavigationcontroller,uiimage
I have an application in swift, where the view controllers are inbedded in a navigation controller, now in the 2nd and 3rd viewcontroller, on the back button, there is a blue arrow pointing backwards (it is there by default). I have tried to remove this, but when I want to...

How to get real image.size in diff devices(iphone4s/5s/6/iPhone6+)?

ios,iphone,uiimage
The original image file PX as (24*50); File name as "icon_detail_black.png" in my project; Using this code: image_ = [UIImage imageNamed:@"icon_detail_black"]; Then the result in diff devices: iphone 4s image_.size = (24*50) iphone 5s image_.size = (12*25) iphone 6 image_.size = (12*25) iphone 6+ image_.size = (8*16.666666667) why? can we...

Get name of img from for loop

objective-c,cocoa-touch,uiimage
I have the following code to display the images: _image = [[imagesModel alloc] initFromURLWithString:imageURL completion:^(id model, JSONModelError *err) { int x = 0; int w = 1; for (imageModel *img in _image.Images) { NSString *picString = [NSString stringWithFormat:picURL, img.filename]; NSLog(@"Images: %@", picString); UIImage *getImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:picString]]]; UIImageView...

Why won't the UIImage change?

ios,swift,uiimage
I looked trough many resources and none have worked for me. I am trying to get an image to change based on the day of the week. I tested out the calendar method in a playground and it would return the correct expected number. However, I am pretty new to...

UIImageView - The image is stretched

ios,uiimageview,uiimage
I loaded the images to the UITableViewCell, but they are obtained stretched. I tried to put the display settings of UIImageView to the AspectFit and AspectFill, but it did not give the expected result. Under the UIImageView there is a UIView. How can I solve this problem? ...

iOS - Received memory warning for showing an image on Today Extension

ios,objective-c,iphone,uiimage
I am trying to download an image from a RSS feed and then show it in today extension widget , the problem is even showing a simple image causes Memory Warning !: _imageView.image = [UIImage imageName:xxx.jpg]; here is my code to download image using UIImageView+AFNetworking: [_wImage setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[item.imagesFromContent objectAtIndex:0]]]...

Create gradient on UIImage for text

ios,objective-c,uiimageview,uiimage
I am trying to replicate the gradient found on the bottom of these album artwork image views. It makes it very easy to read the text no matter what the background is. How would I recreate this? ...

Resize an image with drawInRect while maintaining the aspect ratio like Scale Aspect Fill?

ios,swift,uiimage
I would like to resize an image with drawInRect method, but I would also like to maintain the right aspect ratio, while filling completely the given frame (as .ScaleAspectFill does for UIViewContentMode). Anyone has a ready answer for this? Here is my code (pretty straightforward...): func scaled100Image() -> UIImage {...

CustomTableViewCell Properties aren't being set (they are nil)

ios,objective-c,iphone,uitableview,uiimage
I have a customTableViewCell that I am trying to set an image and some text on. The cell is created successfully, but the properties are nil. I'm not sure if there is something I'm missing in the .xib, but I just can't figure it out. The outlets are set in...

iOS UIImage: set image orientation without rotating the image itself

ios,image,uiimage,uiimageorientation
I am using AVCapture+camera portrait mode to capture an image. when I display the captured image, it is fine--looks fine. But when I convert to jpeg representation and then convert to base64 string to server and server stored it, it is "rotated" already. So I checked the image orientation before...

Swift: Setting UIImage as Background

ios,swift,uiimage,uicolor
My line in viewDidLoad() is complaining about not having an ! in the following statement: view.backgroundColor = UIColor.colorWithPatternImage(UIImage(named: "background.jpg")) However, when I change it to this as suggested: view.backgroundColor = UIColor.colorWithPatternImage(UIImage(named: "background.jpg")!) It gives the following error: fatal error: unexpectedly found nil while unwrapping an Optional value Again, any help...

What is the path of a UIImage

ios,uiimage
I am working with the UIImage class initializer init(contentsOfFile:). But how should I specify the exact path. For example, I have a picture called "Picture" saved in desktop of my mac, and then how can I use this picture? Just "Picture.png" or "/Users/Username/Desktop/Picture.png", or I have to save that picture...

iOS AVAssetWriter Video Height “Squished” when exported to from UIImages

ios,uiimage,avassetwriter,cvpixelbuffer
We are exporting video using AVAssetWriter from UIImages which are first converted to CVPixelBufferRef's - but the images are "squished" in the video by a 160 pixel high black "bar" of empty pixels across the bottom. Given that the images are 640x480, the fact that 160 pixels of black bar...

Cut a UIImage into a circle Swift(iOS)

ios,swift,uiimage
I want to cut a UIImage into a circle so that I can then use it as an annotation. Every answer on this site that I've found describes creating an UIImageView, then modifying that and displaying it, but you cant set the image of an annotation to an UIImageView, only...

How to query an PFFile By Creation Date

ios,swift,parse.com,ios8,uiimage
I am using this code to retrieve images from Parse data... if let userPicture = object.valueForKey("Image") as? PFFile { userPicture.getDataInBackgroundWithBlock({ (imageData: NSData?, error: NSError?) -> Void in if (error == nil) { let image = UIImage(data:imageData!) self.ImageArray.insert(image!, atIndex: 0) } else { self.alert("Error: \(error!) \(error!.userInfo!)", Message: "Make sure you have...

Loading `UIImage` inside `UItableViewCell` not working as expected

ios,objective-c,multithreading,uitableview,uiimage
I have read many questions and answers [here or on the web] through this day and I can't find an answer to my problem. The situation is : I have a custom UITableViewCell that contains a UIImageView, I load the content of the cell from a server and this is...

Getting launch image from XCAssets using imageWithContentsOfFile:

ios,objective-c,xcode,uiimage,imagenamed
I'm attempting to load images from my LaunchImage image set in a .xcassets file, but I don't want do use imageNamed:, as it wastes memory and the image only needs to be displayed for a couple of seconds during initial launch. I have tried multiple approaches to this, but so...

How do I set an UIImage through a animated UIView to another View Controller in SWIFT

swift,delegates,uiimage,uiimagepickercontroller
I currently have View Controller 1 which has UIImageView and a button placed over the top, when that button is clicked I animate a PopUpViewController which is basically w UIView with buttons, this animates over the top of View Controller 1 var popViewController : PopUpViewControllerSwift! //popViewController declared in View Controller...

Try to get a UIImage from Asset Library Url

ios,swift,uiimage,alassetslibrary
I'm trying to get a UIImage Object from a given Asset-Library-Url. I want to make function doing this for me. The given Url is: assets-library://asset/asset.JPG?id=46811D66-DBB4-46D9-BBA2-0CF0D58FC7AD&ext=JPG I tried it with the following approach : var url = NSURL() // url = "assets-library://asset/asset.JPG?id=46811D66-DBB4-46D9-BBA2-0CF0D58FC7AD&ext=JPG" got it from another scene var asset = ALAssetsLibrary()...

What is the way to properly set the height and width of a UIImageVIew in a UITableView?

objective-c,uitableview,uiimage
I am having trouble trying to make an image inside a TableView to not to be oversized. I drag and drop the UIImageView in the UITableViewCell and set the height and width visually (I am using Storyboards). But when I ran the app, the image looks oversized. No matter what...

(Swift) Change the Image tint color of tab bar?

ios,swift,uiimage,uitabbarcontroller,tintcolor
I have created the tabBarController programmatically and I want to change color of tint color of images(not the bar) that tab contains. Can anyone tell me how to do that in Swift?

Adding gesture recognizer to UIImage, not UIImageView

ios,objective-c,uiimageview,uiimage,uigesturerecognizer
I have a UIImageView whose 'View Mode' is set to 'Aspect Fit' in Interface Builder.I want to add gesture recognizer to only my image inside of the UIImageView.To clarify what i say: I have a UIImageView whose bounds.size.width = 100; and bounds.size.height = 100; and I have a UIImage whose...

imageWithContentsOfFile memory issue

ios,objective-c,memory-management,uiimage
My project is having image sharing functionality. In this functionality my app asks the user from which library you want to share. I wrote below code to assign image, retrieved from Default library/Custom library. Device default library imgVwMediaFile.image = [UIImage imageWithCGImage:[asset thumbnail]; //(ALAsset *)asset Custom library (images are at Documents/image/user)...

Adding UIImage's as “Tick Marks” to UISlider

ios,objective-c,uiimage,uislider
To sum up my question beforehand: I'm trying to determine where on the slider I can place the image based upon knowing only the UISlider's duration, and having an array of times to loop through, placing the images accordingly. I've been reading through the Apple Docs on UISlider, and it...

Get ImageView Image Original Size

ios,objective-c,uiimageview,uiimage
I have a TableViewCell with an ImageView, and I am setting the image like so: [self.contentImageView setImageWithURL:thumbnail_url]; The contentMode is set to UIViewContentModeScaleAspectFill, and the subviews are clipped. This works best for images that are either Portrait or Landscape, but UIViewContentModeScaleToFill actually works better for Landscape images, which are far...

How to store PNG images for profile pictures on Parse.com?

ios,xcode,swift,parse.com,uiimage
I am using the code below to sign up a user with username, password, and a profile picture. WHen the profile picture is a JPG it works but NOT when the format is 'PNG`. WHen I upload a png image, the image is blank. I think JPG is working because...

Unable To Get UIImage to Match Custom ImagePickerController Preview

ios,objective-c,iphone,uiimage,crop
I am building an iOS app that is to have a full screen ImagePickerController, with the resulting image that is captured to be the same that is shown in the ImagePickerController View. This is my current relevant code: To create and transform the ImagePickerController: self.imagePicker = [[UIImagePickerController alloc] init]; self.imagePicker.delegate...

How to get video from photoGallery using UIImagePickerController in iOS?

ios,uiimage
I want to get video from photoGallery when I click video button and which is displayed in same view. I have written this code, but don't get video into the imageview on same view. - (IBAction)vedioClicked:(id)sender { imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.allowsEditing = YES; imagePicker.sourceType =...

How to draw four images in circle quarterly equal?

ios,objective-c,uiimage
I need to draw four group images in a circle quarterly equal. can anyone help me below is the screen ...

How to make text appear in centre of the image?

swift,ios8,uiimageview,uiimage,uigraphicscontext
I want to add a text on an image, and I'm able to do it as shown in below code. func textToImage(drawText: NSString, inImage: UIImage, atPoint:CGPoint)->UIImage{ // Setup the font specific variables var textColor: UIColor = UIColor.redColor() var textFont: UIFont = UIFont(name: "AmericanTypewriter", size: 75)! let textStyle = NSTextEffectLetterpressStyle //Setup...

Can't load image with UIImage or NSData

ios,swift,uiimage,nsdata
I am programming a Swift application, and I can't load image saved in the application by using UIImage(contentsOfFile: imgPath) or NSData(contentsOfFile: imgPath) private func loadData() { println("load DATA DANGEROUS") let (dangerous, err) = SD.executeQuery("SELECT * FROM Dangerous") if err == nil && !dangerous.isEmpty { var tabPhoto : [DangerousImage] = []...

making an image the full size of a scrollview

swift,uiscrollview,uiimage
I have set an image as a background in my scrollView so i can zoom in a pan around it, however, when the image is completely zoomed out it creates white borders to the left and right of the image which i can only assume is the scrollView margins. Any...

Do I need to include images for a non-retina iPhone and 6+?

ios,objective-c,xcode,uiimage
In my app I am using images of size 155*155pts so I am supplying it with an image of 310*310px resolution. I know that I can use image.png [email protected] and [email protected] and then [UIImage imageNamed: image] to select the image appropriate for the resolution. My question is do I really...

How to use UIImage to represent user's wins and losses?

ios,objective-c,uiimageview,uiimage
I am new to iOS development and I am trying to make a game that shows the user's wins and losses on a horizontal bar like this: Do I need to use two UIImageViews to do this? Also, how can I make the bar adjust according to the wins and...

How do I add text to an image in iOS Swift

ios,swift,uiimage
I have looked around and have been unsuccessful at figuring out how take text, overlay it on an image, and then combine the two into a single UIImage. I have exhausted google using the search terms I can think of so if anyone has a solution or at least a...

Converting PFFile to UIImage

ios,swift,uiimage,pffile
What are the steps to convert the PFFile to UIImage I managed to get the image from parse as PFFile. But I can't show the view to the user since its not an UIImage. Can anyone guide me please? I keep getting error: [UIImageView setFile:]: unrecognized selector sent to instance...

Extract image from Json

json,xcode,uiimage
I´ve created this Json: {"daysWeek":[ { "titleInside":"Monday", "descriptionInside":"First", "image":"http://example.com/monday.jpg", }, { "titleInside":"Tuesday", "descriptionInside":"Second", "image":"http://example.com/Tuesday.jpg", }] } I´ve already extract the information of "titleInside" and "descriptionInside" and put them in my tableView as follows: NSDictionary *days = [self.daysWeek objectAtIndex:indexPath.row]; cell.titleLabel.text = [days objectForKey:@"titleInside"]; cell.descriptionLabel.text = [days...

Custom UITableView cell with UIImage from border to border

ios,objective-c,uitableview,uiimage
I have a custom UITableViewCell with a UIImage that should be covering the entire cell. I created the size of the cell as 320x104 and the image as 320x104. I set autolayout constraints on the UIImage for Leading,Trailing,Top and Bottom space to container. However when I run my application, the...

UIImage “imageNamed:” works on iOS 8, but not 7?

ios,ios7,ios8,uiimage,imagenamed
There are several answers on SO already about "imageNamed:" not working, but none have included my particular wrinkle: I'm getting nil from "imageNamed:" on iOS 7, but the same build works on iOS 8. Obviously, everything is hooked up properly because it does work on iOS 8, but it consistently...

How to cut the shape of a logo(png image) from another image programmatically in Swift?

ios,swift,uiimage,core-graphics
This is the background image This is the logo How can we make a image like this in Swift? Update Now I manage to use the logo as a mask and get something like this, Is there any way to reverse the mask? Here is my code let logo =...

button.setTitle blanks out image view

ios,swift,uiview,uiimage
Can anyone tell me why setting the button.setTitle(string, forState) function blanks out the UIImage? If I comment out both lines that use the button.setTitle, the animation runs fine. When the lines are there, the animation disappears when I press the button. The var cryButton: UIButton and the function UpdateImage refer...

how to show the NSData value in UIImage View while retrieving the database

ios,objective-c,sqlite,uiimage,nsdata
Added the images as NSData in database successfully. But while i'm retrieving back NSData to UIImage its not working. The following codings that i used for retrieving the database any error please suggest me. Here i used primary key to fetch correct image presented in particular record: -(void)ShowImagesinImageView{ NSLog(@"Loaded in...

Is it possible to get a reference to a UIImage when capturing an image with UIImagePicker

ios,objective-c,uiimage
Right now I use the following to save a picture to my Photos album -(void)shootPicture{ [self.PickerController takePicture]; } But I want to be able to get a reference to the UIImage rather than save it immediately to my camera roll. Is there a way to achieve this in IOS?...

Slight delay before image blurred

ios,objective-c,uitableview,uiimageview,uiimage
I'm using LBBlurredImage https://github.com/lukabernardi/LBBlurredImage with this tutorial http://www.raywenderlich.com/55384/ios-7-best-practices-part-1, and was wondering why it takes a second when a UITableViewCell is supposed to blur (when swiping up immediately when the app opens to see the next tableview cell)? When I swipe up to go to the next table view cell, the...

UIImage not shown as expected

ios,objective-c,uitableview,uiimageview,uiimage
- (void)showImageAtTableView:(UITableView *)tableView forRowAtIndexPath:(NSIndexPath *)indexPath { if ([tableView indexPathsForSelectedRows].count) { if ([[tableView indexPathsForSelectedRows] indexOfObject:indexPath] != NSNotFound) { //cell is expanded CGFloat frameHeight = [[self.widthArray objectAtIndex:indexPath.row] floatValue]; CGFloat frameWidth = [[self.heightArray objectAtIndex:indexPath.row] floatValue]; //CGFloat yOrigin = [self configureHeightForRowAtIndexPath:indexPath]; CGRect imageFrame = CGRectMake(0, 12, frameWidth,...

Error in overriding image property of ImageView

ios,iphone,uiimageview,uiimage,abstract-class
I am trying to override getter of ImageView to return placeholder image if imageView not settled, But I have error and I can not do it. Why this happens and how can I solve this problem? My code @implementation OvalImageView - (UIImage *)image { return _image? _image : [UIImage imageNamed:@"avatar-big-placeholder"];...

looping variable in swift

swift,for-loop,uiimage
i want to change this variable become looping in swift: var image1 = UIImage(named: "image1") var image2 = UIImage(named: "image2") var image3 = UIImage(named: "image3") var image4 = UIImage(named: "image4") var image5 = UIImage(named: "image5") var image6 = UIImage(named: "image6") var image7 = UIImage(named: "image7") images.append(image1!) images.append(image2!) images.append(image3!) images.append(image4!) images.append(image5!)...

UIImage size in a tableView Cell

ios,objective-c,iphone,uitableview,uiimage
I have an image 1024x1024 and I want resize this image to fit into a tableView Cell. I have used this lines of code: + (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize { //New size is the size of the cell for me UIGraphicsBeginImageContext(newSize); [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData *imageData = UIImagePNGRepresentation(img);...

image was taken by UIImagePickerControllerSourceTypeCamera how to save it in database in ios

ios,objective-c,xcode,uiimage,uiimagepickercontroller
coding in .m -(IBAction) getPhoto:(id) sender { UIImagePickerController * picker = [[UIImagePickerController alloc] init]; picker.delegate = self; if((UIButton *) sender == choosePhotoBtn) { picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; } else { picker.sourceType = UIImagePickerControllerSourceTypeCamera; } [self presentModalViewController:picker animated:YES]; } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker...

Is it possible to trim a UIImage to circular form?

ios,objective-c,parse.com,uiimage
I was wondering if it was possible to set the corner radius of a UIImage and then save that trimmed UIImage (to Parse). I'd like the image being uploaded to Parse be circular and I was wondering if I could set the corner radius like this, then upload the image...

UIImage returns null first time, until reloaded? [duplicate]

ios,objective-c,uiimage,nsurl
This question already has an answer here: didReceiveData is not getting all data 2 answers I retrieve NSData from a url, then I try set it to an image. In the console it returns null, however when I request the data and set the image again, the image than...

UIImage aspect fill offset

ios,uiimage
Is there a way to define a custom offset for a UIImage with aspect fill? So currently aspect fill scales the image and centres it. But I need a way to then define a offset, so I can manually adjust the image to fit even better. Is this possible? I...

Trying to place a UIView over top of a UIImageView to highlight a section of UIImage

ios,uiview,uiimageview,uiimage
I am building an app that displays text from a book on the screen. The text of the page is aUIImage, and is contained inside of aUIImageView on the screen. What I would like to do is highlight each line of the page, using aUIIView that is placed over top...

iOS App Crash when receiving warning memory

iphone,c,get,uiimage,transparent
I use two methods to get transparent pixels from UIImage. They are called a lot of times while I drawnig a line in the screen. When the methods start to be called, app crashes, and I get memory warning. I’ve already add @autorelease, and  CGContextFlush(), but it still doesn’t work.How to...

Add a semi-transparent layer to UIImage using Core Graphics

ios,objective-c,uiimage,core-graphics,alpha
I need to take a UIImage and to add a semi-transparent layer in order to produce a new UIImage. I think I'm getting close but something is still wrong. Here's my code: - (UIImage*) addLayerTo:(UIImage*)source { CGSize size = [source size]; UIGraphicsBeginImageContext(size); CGRect rect = CGRectMake(0, 0, size.width, size.height); [source...

Saving image from url to disk not working

objective-c,uiimage,afnetworking,afnetworking-2
I'm trying to download an image from an url in my app, so that it can be used by the Today Extension. So I call [self downloadImageFromUrl:imageOne];, which uses this method: - (void)downloadImageFromUrl:(NSString *)url { NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; requestOperation.responseSerializer = [AFImageResponseSerializer...

Swift: UIImages appearing out of order in table view

ios,swift,uitableview,uiimage
I'm querying images from my Parse backend, and displaying them in order in a UITableView. Although I'm downloading and displaying them one at a time, they're appearing totally out of order in my table view. Each image (album cover) corresponds to a song, so I'm getting incorrect album covers for...

Set UIButton Image in Swift - currently unwraps as nil

ios,swift,uibutton,uiimage,optional-values
I am having a difficult time setting an image of a UIButton. I have checked other posts on how to do this, and it seems straightforward enough (but then, here I am). In my program, the image that the button displays depends on trip.weather. I am using a switch to...

UIImage in scrollview too big

ios,objective-c,uiimage
I am trying to show a UIImage inside a scrollview. The image is much larger in size than the scrollview, so it displays only the top-left corner of the image. I can then zoom / rearrange the image to fit a little better, but i want it to display the...

UIImage shows an empty square instead of image

ios,objective-c,uiimage
I try to show a png image on my navigation panel. I do as following: UIImage *img = [UIImage imageNamed:@"1.png"]; UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithImage:img style:UIBarButtonItemStylePlain target:self action:@selector(myAction)]; self.navigationItem.rightBarButtonItems = @[myButton]; The img isn't nil, however myButton is shows as a white square. The size of this square is...

Swift equivalent for UIImage with CGImage?

ios,objective-c,iphone,swift,uiimage
What is the Swift equivalent for the following expression? @property (strong, nonatomic) NSMutableArray *assets; cell.imageView.image = [UIImage imageWithCGImage:[[self.assets objectAtIndex:indexPath.row] thumbnail]]; I tried: private var assets: [AnyObject] cell.imageView.image = UIImage(CGImage: self.assets[indexPath.row].thumbnail()) But this gives the error: Missing argument for parameter 'inBundle' in call Edit: self.assets has objects from the following expression:...

SIGABRT on cast to UIImage

ios,casting,uiimage
I'm using FastttCamera as a wrapper to AVFoundation for taking, processing and displaying a picture. Here's my code (a FastttCamera delegate method) in which I cast (FastttCapturedImage *) to (UIImage *): - (void)cameraController:(FastttCamera *)cameraController didFinishScalingCapturedImage:(FastttCapturedImage *)capturedImage { //Use the captured image's data--note that the FastttCapturedImage is cast to a UIImage...

Draw UIImage in a CALayer

objective-c,uiimage,calayer
Is it possible to draw an existing png image inside a CALayer? If not, how can I have the image as a sublayer of a CALayer?

Pixel Array to UIImage in Swift

ios,arrays,swift,uiimage,cgimage
I've been trying to figure out how to convert an array of rgb pixel data to a UIImage in Swift. I'm keeping the rgb data per pixel in a simple struct: public struct PixelData { var a: Int var r: Int var g: Int var b: Int } I've made...

Convert a Base64 NSString to UIImage? [duplicate]

ios,uiwebview,uiimage
This question already has an answer here: Create a UIImage from string data 1 answer The NSString is got from UIWebView used the following javascript method: function() { var img=document.getElementById("myimg"); var canvas = document.createElement("canvas"); var context = canvas.getContext("2d"); canvas.width = img.width; canvas.height = img.height; context.drawImage(img,0,0,img.width,img.height); return canvas.toDataURL("image/png"); } I...

unable to resize image properly

ios,objective-c,cocos2d-iphone,uiimage
I am having problem with UIImage resizing, image masking is working fine but after applying mask UIImage is starched, the problem is with scaling as image is not scaled properly. CCClippingNode *clippingNode = [[CCClippingNode alloc] initWithStencil:pMaskingFrame ]; pTobeMasked.scaleX = (float)pMaskingFrame.contentSize.width / (float)pTobeMasked.contentSize.width; pTobeMasked.scaleY = (float)pMaskingFrame.contentSize.height / (float)pTobeMasked.contentSize.height; clippingNode.alphaThreshold = 0;...

Is there any way to use `UIImageRenderingModeAlwaysOriginal` in appdelegate for all UIImage Property across the project

ios,objective-c,iphone,uiimage
[[UITextField appearance] setTintColor:[UIColor myColor]]; [[UITextView appearance] setTintColor:[UIColor myColor]]; After setting UITextField & UITextView cursor color in appDelegate, suddenly I am facing that there is a lot of NavigationItemBar image turn into default Blue color. It's actual color is not showing. The solution is to set each NavigationItemBar image rapped up...

UIImage takes up much more memory than its NSData

ios,memory,uiimageview,uiimage
I'm loading a UIImage from NSData with the following code var image = UIImage(data: data!) However, there is a weird behavior. At first, I used png data, and the NSData was about 80kB each. When I set UIImage with the data, the UIImage took up 128kb each. (Checked with Allocation...

How do I make image-based tiled background for UIView so that it doesn't scale?

ios,swift,uiimage
In iOS application, I have 250x85pt UIView. I would like it to have image-based tiled background. The original image is 398x398 px. I would like my image to tile. When I run application, my image tiles, but for some reason it scales as follows: I used the following code to...

Memory continuously increase then app crash when i display image from document directory during scrolling UITableview

ios,iphone,uitableview,memory-management,uiimage
My Requirement is download all images in application memory and display it from local if its available. Below is my code to access image from local and if its not available then it will download then display. [cell.imgProfilePic processImageDataWithURLString:cData.PICTURE]; I have made custom UIImageView class DImageView.h #import <UIKit/UIKit.h> @interface DImageView...

Generated image in iOS app looks different from original vector image

ios,vector,uiimage,xcode6
I added a PDF vector file in xcode image assets. The vector file has color and designs. However, when it is generated on the simulator, the shape retains, but the color and the design is all gone, replaced w a flat color. // code to add the button - (void)...

How to make Image page viewer for images swift ios

ios,swift,uiimageview,uiimage,uipageviewcontroller
I wanna display a couple of images from the assets folders, into my application. so I wanna make a page view. First, images will be inside collection view, then on click, the image will be full screen. Then the user can slide between the images by swiping right and left...

How to draw a UIImage rectangle with one or more 100% translucent circles?

ios,uiimage,core-graphics
End Goal I'm doing a tooltip feature for one of my views. The tooltip view will be presented in a modal fashion over the view it's giving tips on. Most of the view will be a dark translucent background, except for one or two key points that need to be...

How to load all images with similar names

ios,objective-c,uiimage,xcasset
I have several images in my xcasset, so i can load image with: [UIImage imageNamed:@"face_icon_1"]; If my images names is like "face_icon_2", "face_icon_3" and etc., how do i found them all and without hardcode? ...

Image unrecognized ios

ios,uiimage
I have an UIImage that I assign to an UIImageView. When I do : UIImage *picto = [UIImage imageNamed:@"animage.png"]; UIImageView *imageView1 = [[UIImageView alloc] initWithImage:picto]; it works, but when I do : UIImage *picto = [UIImage imageNamed:@"animage2.png"]; UIImageView *imageView1 = [[UIImageView alloc] initWithImage:picto]; My image 2 isn't displayed, the grammar...

UIImage gets released at the end the function after assignment has been made

ios,objective-c,uiimage,assign
I have a ViewController that holds a custom UIView as its member like this: @property (nonatomic, strong) IBOutlet ProfileUIView * profileUIView;in my ViewController i get back a UIImage from an imagePickerController:didFinishPickingMediaWithInfo: and there i'm assigning the UIImage i get to a local UIImage variable in my ProfileUIView. i see that...

Adding Image And title both to UIsegmentControl IOS

ios,uiimage,title,uisegmentedcontrol
Is there a way so that you can set both image and title of UISegmentControl simultaneously, so that image appear next to the title , just like image appear next to title in UIButton. I am trying but if I set image of Selected segment of UISegmentControl then title disappears...

How to show the the title under the UIButton?

ios,objective-c,uibutton,uiimage
I have used the title inset to display the text name under theUIButton. Here's my code and the output : [button setTitleEdgeInsets:UIEdgeInsetsMake(60, 0, 0, 0)]; Here's my expected output : I have used theUIButton and set the title and UIImage as background. So how to show the title label under...

Rescale image so width is half the size of screen

ios,swift,uiimageview,uiimage,image-scaling
I'm fairly new to swift and I'm currently trying to display multiple image views within a custom UITableCell. Ideally, I would like to have each image be scaled so that its width fills half of the screen size (while preserving the original aspect ratio). The idea is that each UITableCell...

Memory issues with UIImage Animation Image Caching

swift,animation,keyboard,uiimage,uicollectionview
I've been banging my head against this for days now and just can't get to the bottom of it. Basically i have the keyboard extension which uses a UICollectionView to display animated UIImages. When it's running and i switch to another app then switch back to the keyboard i'm getting...

ImageView image not being drawn when viewcontroller bgcolor is being set

ios,objective-c,uiimageview,uiimage
running into a weird issue. Within the prepareForSegue method in my HomeViewController.m file, I'm doing this: -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(UIButton *)sender { StarViewController *nextViewController = segue.destinationViewController; nextViewController.title = segue.identifier; if ([segue.identifier isEqualToString:@"redDwarfSegue"]) { //nextViewController.view.backgroundColor = [UIColor redColor]; nextViewController.starImage = [UIImage imageNamed:@"image1"]; } else { nextViewController.view.backgroundColor =...

Create Hexagon ImageView shape in iOS

ios,uiimageview,uiimage,core-graphics,uibezierpath
I want Above Hexagon shape for my ImageView. But After implementing below code I am getting this Image - (UIBezierPath *)roundedPolygonPathWithRect:(CGRect)square lineWidth:(CGFloat)lineWidth sides:(NSInteger)sides cornerRadius:(CGFloat)cornerRadius { UIBezierPath *path = [UIBezierPath bezierPath]; CGFloat theta = 2.0 * M_PI / sides; // how much to turn at every corner CGFloat offset =...

iOS Animate Mask Over UIImage

ios,swift,animation,uiimage
I am using Swift 1.2 and my goal is to animate an image mask over a static UIImage. What I have implemented is a swift version of masking an image that I originally found in Objective-C. func maskImage(image: UIImage, mask: UIImage) -> UIImage! { let maskRef = mask.CGImage; let mask...

Swift - Passing an UIImage to an UIImageView via delegation

ios,swift,uiimageview,uiimage,protocols
I'm out of ideas and I have no idea how to solve this. Any help will be appreciated. I've got the following situation: MainViewController which points to a CollectionView embedded in a NavController CollectionView points to a DetailViewController DetailViewController shows the full picture chosen in the CollectionView and has a...

Is there a way to shorten if-statements?

swift,if-statement,uiimage,ibaction,arc4random
I am wondering if there is a way to the following code shorter. I have done this same type of thing for other Xcode projects in the past and it has been very time consuming. Here is the code: @IBAction func flashButton(sender: UIButton) { flashButton.hidden = !flashButton.hidden flashingImageView.hidden = !flashingImageView.hidden...

snapshotView of UIView render/draw in context with nothing

ios,objective-c,iphone,uiview,uiimage
I'm trying to render/draw the snapshotView of a UIView in contex to get a UIImage.then set it as a CAlayer.contents. I try this method to get snapshotView: snapshotViewAfterScreenUpdates: then convert UIView to UIImage: UIGraphicsBeginImageContext(view.bounds.size); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; //I'm trying this method too [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); the...

Loading multiple saved images in app slows it down

ios,swift,uiimage,xcode6
I am developing an app where user can save 13 screenshots and display them on a single view as thumbnails or as a full screen image. let fileName:String = self.stickerUsed + ".png" var arrayPaths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as NSString var pngFileName = arrayPaths.stringByAppendingPathComponent(fileName) UIImagePNGRepresentation(screenshot).writeToFile(pngFileName, atomically:true) NSUserDefaults.standardUserDefaults().setObject(fileName, forKey: self.stickerUsed)...

How do I detect the name of a random UIImage?

ios,swift,uiimage,uiswipegesturerecognizer
I have a random image popping up using this code: @IBOutlet weak var imageView: UIImageView! @IBAction func startButton(sender: AnyObject) { UIView.animateWithDuration(0.5, delay:2, options:UIViewAnimationOptions.TransitionFlipFromTop, animations: { self.imageView.alpha = 2 }, completion: { finished in self.imageView.image = UIImage(named: "gameBall\(arc4random_uniform(12) + 1).png") }) } When the user swipes down I want to detect...

Some images cannot be passed to imageview.image, why?

ios,objective-c,xml,image,uiimage
Parsing xml data from a table view to a detail view, I pass data to imageview.image. Some images appear in view, some not. When I debug, imageview.image is sometimes nil and sometimes an image object. imageview.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:sharedDelegate.imagObj]]]; This is the code in viewdidload. In link all...

Swift: Display image from UIImage array in table view

ios,arrays,uitableview,swift,uiimage
I am getting images from an async request and adding them to a [UIImage]() so that I can populate my UITableView images with those from the array. The problem is, I keep getting Fatal error: Array index out of range in the cellForRowAtIndexPath function when this is called, and I...

EXC_BAD_ACCESS when loading UIImage in Swift

swift,uiimage,exc-bad-access,iso
I'm quite new to the iOS platform, but am already an experimented Android dev. I'm experiencing a weird issue in Swift, we cannot reproduce in Objectice-C. We are designing our interfaces by hand, without using the Interface Builder, to have more flexibility. We are getting a EXC_BAD_ACCESS on the mentioned...

Swift: Pan UIImage using constraints

ios,swift,uiimage,autolayout,constraints
I have an UIImage in my viewController that I am using the UIPanGesture on. I am currently using the following code to move it around based on the RayWenderlich tutorial. @IBAction func panImage(sender: UIPanGestureRecognizer) { let translation = sender.translationInView(self.view) if let view = sender.view { view.center = CGPoint(x:view.center.x + translation.x,...

Is it possible to add a UIImage to CPTGraph?

ios,objective-c,uiimage,core-plot
I'm trying to add an image to a graph using Core-Plot and I want the image to move along with the graph when it being dragged or pinched. I've tried the code below but it didn't work. Can anyone tell me how to do so? CALayer *subLayer = [CALayer layer];...