uiimageview

“This application is modifying the autolayout engine from a background thread”

自闭症网瘾萝莉.ら 提交于 2019-12-04 14:38:36
I am having an error of: This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes whenever I try to load an image view into a table view. The relevant code is as follows: override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cellIdentifier = "ArticleCell" let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! ArticleCell let a: Article = self.articlesArray[indexPath.row] as! Article //let a: Article = self

How to apply Perspective 3d Transform on image and save that image in document directory

拟墨画扇 提交于 2019-12-04 14:36:10
I am applying 3D transform on a image layer by follow code. UIImageView *view = (UIImageView *)[recognizer view]; CGPoint translation = [recognizer translationInView:self.view]; CGPoint newCenter = view.center; newCenter.x += translation.x; newCenter.y += translation.y; view.center = newCenter; [recognizer setTranslation:CGPointZero inView:self.view]; Following is the from which the points are converted to transform. UIView+Quadrilateral [self.view transformToFitQuadTopLeft:self.topLeftControl.center topRight:self.topRightControl.center bottomLeft:self.bottomLeftControl.center bottomRight:self

kCAFilterNearest maginifcation filter (UIImageView)

社会主义新天地 提交于 2019-12-04 14:16:22
问题 I am using QREncoder library found here: https://github.com/jverkoey/ObjQREncoder Basically, i looked at the example code by this author, and when he creates the QRCode it comes out perfectly with no pixelation. The image itself that the library provides is 33 x 33 pixels, but he uses kCAFilterNearest to magnify and make it very clear (no pixilation). Here is his code: UIImage* image = [QREncoder encode:@"http://www.google.com/"]; UIImageView* imageView = [[UIImageView alloc] initWithImage

Drawing a transparent circle on top of a UIImage - iPhone SDK

你离开我真会死。 提交于 2019-12-04 14:14:59
问题 I am having a lot of trouble trying to find out how to draw a transparent circle on top of a UIImage within my UIImageView. Google-ing gives me clues, but I still can't find a working example. Are there any examples that anyone knows of that demonstrate this? 回答1: Easiest way is simply to create a semi-transparent square UIView, then set the cornerRadius of its layer to be half of its width/height. Something like: UIView *squareView = [[UIView alloc] initWithFrame:CGRectMake(0,0,100,100)];

Prevent UIScrollView from moving contents to top-left

浪尽此生 提交于 2019-12-04 14:02:24
I have a UIImageView contained within a UIScrollView . The image is (usually) big, so the user can zoom it out in order to see the whole thing. Upon zooming out, though, UIScrollView snaps the ImageView to the top-left of the scrollview. I want this to be positionable by the user, and haven't found a way to "turn it off" yet. It's kinda like always allowing scrolling, rather then only allowing scrolling when the image is zoomed in. Maybe it's too major of a change? Anyone know of a way? Originally, I was just going to create this functionality manually. But UIImageViews don't like to adjust to

How to change particular image in recycler view after clicking

雨燕双飞 提交于 2019-12-04 13:59:12
问题 I want to change respective image of clicked item in recycler view. Now whats happening is if i click on item 2 image is changing at random item position in the list public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.DataObjectHolder> { private static String LOG_TAG = "MyRecyclerViewAdapter"; private ArrayList<CRMbean> mDataset; private static MyClickListener myClickListener; static Context mContext; private List<String> mtList ; public MyRecyclerViewAdapter

UIImage: How to get website tab icon

孤者浪人 提交于 2019-12-04 13:19:32
问题 I'm developing an RSS Reader and I need to get the favicon for each feed. For example, if my feed is google.com, I'd like to get the "G" icon and put it into a UIImage or something. Any ideas on how to achieve this? 回答1: The easiest way to go would be to use Google: NSString *myURLString = @"http://www.google.com/s2/favicons?domain=www.stackoverflow.com"; NSURL *myURL=[NSURL URLWithString: myURLString]; NSData *myData=[NSData dataWithContentsOfURL:myURL]; UIImage *myImage=[[UIImage alloc]

Load images from NSURL async with RestKit

眉间皱痕 提交于 2019-12-04 13:18:23
问题 Is there a wrapper or some sort of built-in functionality available in RestKit to load a UIImage from an NSURL asynchronously using callbacks or blocks? I could not find such a method in the RestKit docs. If there is not, what is a good strategy for implementing lazy loaded async images from NSURL using RestKit as much as possible? 回答1: Using RestKit you can use RKRequest to load the data for the image in a manner such as: RKRequest* request = [RKRequest requestWithURL: url]; request

“Pinch to Zoom” using AutoLayout

喜你入骨 提交于 2019-12-04 12:13:38
I have followed many "Pinch to Zoom" tutorials I found online, and have done reading on AutoLayout, but I can't get it to work in my project. My whole project uses AutoLayout, so I don't want to turn it off. I am loading a huge UIImage (EG: 5000px on long edge) into a UIImageView, and i'd like to be able to pinch to zoom and move around the zoomed in image. I've tried using UIImageView inside a UISrollView, but I couldn't get it to work properly. The closest I could get was some random "glitching" where the image moved erratically when pinched. Has anybody got 'Pinch to Zoom' to work using

Swift 3: get color of pixel in UIImage (better: UIImageView)

旧街凉风 提交于 2019-12-04 11:50:12
I tried different solutions (e.g. this one ), but the color I get back looks a bit different than in the real image. I guess it's because the image is only RGB , not RGBA . May that be an issue? Related issue: if the UIImage has contentMode = .scaleAspectFill , do I have to do a recalculation of the image or can I just use imageView.image ? EDIT: I tried with this extension: extension CALayer { func getPixelColor(point: CGPoint) -> CGColor { var pixel: [CUnsignedChar] = [0, 0, 0, 0] let colorSpace = CGColorSpaceCreateDeviceRGB() let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo