uiimageview

How to prevent view resizing/transform when UINavigationBar hides/shows

跟風遠走 提交于 2019-12-04 21:29:07
问题 I have an application with a tab bar and a navigation bar. I push a view controller that is used to show photos, one at a time. It initially shows the bars and forward/back controls; after a delay, these hide, using setNavigationBarHidden:animated: and a custom transform ( CGAffineTransformMakeTranslation ) on the tab bar. This works, but the view controllers view , which shows the photo, leaps up and down. The same is true if I leave the tab bar out of the equation. How can I prevent the

iOS: UIImageView changes with change in UITableView.rowHeight, how to avoid?

爱⌒轻易说出口 提交于 2019-12-04 21:17:00
This is really a n00b question, I am learning iOS while trying to build an app I need to show an image, label on UITableViewCell . The following code does that for me - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; cell.imageView.image = [self getImageNameForRow:indexPath.row]; cell.textLabel.text = self.features[(NSUInteger) indexPath.row]; cell.imageView.contentMode = UIViewContentModeScaleAspectFit; return cell; } The problem

dynamic creation of uiimageview in for loop

此生再无相见时 提交于 2019-12-04 21:13:35
Hi i am new to iphone.. I have stored the images in array .I want to know how to display those images in UIImageView ,where the UIImageView should be created dynamically according to filelist count increases, in for loop. this is the code NSArray *filelist; NSFileManager *filemgr; int count; int i=0; int t=0; filemgr = [NSFileManager defaultManager]; filelist = [filemgr directoryContentsAtPath: @"/Mypath/"]; NSMutableArray *imageVwArr = [[NSMutableArray alloc]init]; count = [filelist count]; count++; for(i = 0; i < count; i++) { UIImageView *imgVw = [[UIImageView alloc] initWithImage:[filelist

iOS showing Image from ALAsset in UITableView

夙愿已清 提交于 2019-12-04 21:03:32
I have a db where items are stored. These items can be different kinds of type like text, videos and images. When the View is loaded I fetch these items from the DB and I show them in a UITableView. The problem I am facing is related to show the images in the table view. Basically in the DB I store the ALAsset link related to the picture and from it I try to get its image using this code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ //...Other Code else if ([object isMemberOfClass:[Picture class]]){ //Get a reusable cell cell =

colorWithPatternImage Vs. UIImageView

蓝咒 提交于 2019-12-04 20:53:27
问题 Which is better to use if I simply want a background image for a UIView ? I can accomplish this with either method, but which is more efficient? My hunch is that using a UIView with colorWithPaternImage is more efficient than using a UIImageView . I'll be using this for each row in a UITableView . Thanks! Matt 回答1: Completely disagree with boreas. There can be significant differences using colorWithPatternImage vs other strategies depending on your requirements. For example, if you are using

UIImageView rotation animation in the touched direction

浪子不回头ぞ 提交于 2019-12-04 20:44:32
I have one UIImageView having an image of an arrow. When user taps on the UIView this arrow should point to the direction of the tap maintaing its position it should just change the transform. I have implemented following code. But it not working as expected. I have added a screenshot. In this screenshot when i touch the point upper left the arrow direction should be as shown.But it is not happening so. -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch=[[event allTouches]anyObject]; touchedPoint= [touch locationInView:touch.view]; imageViews.transform =

Image became horizontal after successfully uploaded on server using Http Post

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 20:31:28
i capture the image using image picker, at the that time image is in its actual position. but after uploading it on server it became horizontal. i don't get any clue why that happening. here is my code NSString *urlString = @"Url"; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSMutableData *body = [NSMutableData data]; NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"]; NSString *contentType = [NSString stringWithFormat

Swift UIView with multiply effect

三世轮回 提交于 2019-12-04 19:59:55
What I've been trying to achieve for a couple of hours is something like the following: I would like to have a UIImage in the background and then preferably a UIView with a background color of red with some kind of multiply effect (the red area). Is this possible? I've seen a few extensions for UIImage that tints them, but that would only work if I wanted my WHOLE image to have a red multiply color effect. Thanks Kex You could just add a red UIView to the top of your UIImageView . Adjust the alpha to make it transparent: let someView = UIView(frame: someImageView.frame) someView

How to load image asynchronously with Swift using UIImageViewExtension and preventing duplicate images or wrong Images loaded to cells

☆樱花仙子☆ 提交于 2019-12-04 19:55:38
Im developing an image loading library in Swift 4 something like Kingfisher with some extensions to support loading images from URL into an UIImageView . So then i can use this extension on a UICollection or UITableview cell with an UIImageView like this : let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectioncell", for: indexPath) if let normal = cell as? CollectionViewCell { normal.imagview.loadImage(fromURL:imageURLstrings[indexPath.row]) } Basically this is my extension Code , implementing the basic URLSession dataTask and Caching public extension UIImageView {

How to resize a UIImageView to fit the underlying image without moving it?

泄露秘密 提交于 2019-12-04 19:51:52
问题 I have a UIImageView whose frame, set before the image is loaded, is always too large for the image, so when I try to round the corners, for example, nothing happens. How can I resize the frame so it's the same size as the underlying image, while ensuring that the center point of the UIImageView does not change? 回答1: If you change the bounds of a UIView the center will not change. CGRect bounds; bounds.origin = CGPointZero; bounds.size = newImage.size; imageView.bounds = bounds; imageView