uiimageview

How to set the table view cell accessory view to retain a previously initialized UIImageView?

假装没事ソ 提交于 2019-12-30 08:29:22
问题 Let's say I have a property in my view controller, defined as follows: @property (nonatomic, retain) UIImageView *checkmarkOffAccessoryView; I @synthesize this in the implementation, release it in -dealloc and initialize it in -viewDidLoad as follows: self.checkmarkOffAccessoryView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkmarkOff.png"]] autorelease]; So far so good. When I use it in my table view delegate as an accessory view for multiple cells, two things happen: Only

How to restrict a moveable view by Pan gesture

会有一股神秘感。 提交于 2019-12-30 06:33:29
问题 I have a UIImageView which is moveable via a pan gesture. UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; [self.photoMask addGestureRecognizer:pan]; I would like to restrict the area this can be moved on screen. Rather than the user be able to drag the view right to the side of the screen, I want to restrict it by a margin of some sort. How can I do this? Also, how is this then handled when rotated? EDIT --- #pragma mark -

rotating a view on touch

≯℡__Kan透↙ 提交于 2019-12-30 04:38:06
问题 I have to rotate a view circularly on finger touch...I mean like dialing the old phones number...and the touch should be only on corners.....can any one help me...i have tried it a lot...but was not successes 回答1: You need to define the UIRotationGestureRecognize on the view that you want to rotate and than add a selector method and implement it like this. Add this to you viewDidLoad method UIRotationGestureRecognizer *rotate = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:

Image suggestions are not working Xcode 10

假如想象 提交于 2019-12-30 04:17:28
问题 I am trying to set image to UIImageView . Its working well in older version. In Xcode 9.4.1 But in Xcode 10 When I am trying to type name of image, image suggestion is not showing. Even "Image Literal" is not working. Double clicking on above icon also not working. Is there any setting in Xcode preferences? How to enable image suggestion like before? 回答1: In Xcode 10 and Swift 4.2, only the code completion function (or auto-complete) of the Xcode IDE has been discontinued for the old way.

Add Text to the Image

烂漫一生 提交于 2019-12-30 03:33:27
问题 HI Im currently developing an application where i have to add the text over the image at any position in the image(not subview) and the output should be the single image file with the original image and the text embedded in it,any help will be appreciable. eg : water mark on the image Thanks sivasankar 回答1: UIImage *myImage = loadUnwatermarkedImage(); NSString *myWatermarkText = @"Watermark"; UIImage *watermarkedImage = nil; UIGraphicsBeginImageContext(myImage.size); [myImage drawAtPoint:

Passing image from one view to another

你。 提交于 2019-12-30 03:32:04
问题 I'm getting an image from the user from the photo gallery, and I want to pass it to a another view... I've read that I should be able to simply do something like this: secView.imgView.image = selectedImage.image; Setting my UIImageView on the second view to be the image from my UIImageView... But the UIImageView in the second view is just empty... My code is this... ViewController.h: @interface ViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate>

iOS - adding/removing a subview programmatically

余生颓废 提交于 2019-12-30 02:09:09
问题 Ok I want to add a UIImageView as a subview and then remove it after a couple of seconds in the way a splash screen works. I found three different approaches to do it but I can not understand which one is the best approach according to Objective-C and Apple. Below are the three different approaches: 1) In my MyAppDelegate.h @interface MyAppDelegate : NSObject <UIApplicationDelegate> { MyViewController *myViewController; UIImageView *myImageView; } @property (nonatomic, retain) IBOutlet

Adding image to navigation bar

被刻印的时光 ゝ 提交于 2019-12-29 10:16:11
问题 I'd like an image to take up all of a navigation bar. This is the navigation that comes with a navigation based app. It appears on the RootViewController with the accompanying UITableView. I've seen some examples of how this might work. Set navigation bar title: UIImage *image = [UIImage imageNamed:@"TableviewCellLightBlue.png"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; [self.navigationController.navigationBar.topItem setTitleView:imageView]; The problem there is it

Works on iPhone Simulator but not on device

可紊 提交于 2019-12-29 07:45:31
问题 Here I addsubviews (UIImageViews) it all works on the simulator but not on the device (iOS 4.1) wtf!? - (void)addChips:(int)value { UIImage *chipImage; switch (value) { case 5: chipImage = [UIImage imageNamed:@"5chip"]; break; case 25: chipImage = [UIImage imageNamed:@"25chip"]; break; case 100: chipImage = [UIImage imageNamed:@"100chip"]; break; case 500: chipImage = [UIImage imageNamed:@"500chip"]; break; default: break; } int chipCount = [chipsOnBet count]; UIImageView *addChip = [

how to split an image in to multiple parts [duplicate]

被刻印的时光 ゝ 提交于 2019-12-29 07:15:30
问题 This question already has answers here : how to crop image in to pieces programmatically (4 answers) Closed 5 years ago . how can I slice an image into multiple pieces ? my image size is 300x300 an I want to make 9 pieces of it. Thanks.. 回答1: CWUIKit project available at https://github.com/jayway/CWUIKit has a category on UIImage adding a method like this: UIImage* subimage = [originalImage subimageWithRect:CGRectMake(0, 0, 100, 100)]; Should be useful for you. 来源: https://stackoverflow.com