Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set UIImage property not working #3

Open
jasanchezsa opened this issue Apr 3, 2014 · 3 comments
Open

Set UIImage property not working #3

jasanchezsa opened this issue Apr 3, 2014 · 3 comments

Comments

@jasanchezsa
Copy link

Hello, first congratulations for the project. Sorry for my English.

This code working:

UIImageViewAligned *imageAlign = [[UIImageViewAligned alloc] initWithFrame:CGRectMake(0, 0, 280, 280)];
[imageAlign setImage:[UIImage imageNamed:@"exampleImage.png"]];
imageAlign.contentMode = UIViewContentModeScaleAspectFit;
imageAlign.alignBottom = YES;
imageAlign.alignLeft = NO;
imageAlign.alignRight = NO;
imageAlign.alignTop = NO;
[self.viewContent addSubview:imageAlign];
[imageAlign setBackgroundColor:[UIColor greenColor]];

But when I use an image in memory that comes from another UIViewController is not working:

imageAlign.image = self.currentImage;

Thank you very much.

@reydanro
Copy link
Owner

reydanro commented Apr 3, 2014

What happens exactly?
Is there no image displayed?

@jasanchezsa
Copy link
Author

The Image displayed but aligment not working.

@jasanchezsa
Copy link
Author

@interface OneViewController ()
@property (nonatomic, strong) UIImage *currentImage;
@end

@implementation OneViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    [self setCurrentImage:[Image of camera picker];
}

- (void)pushTwoViewController
{
TwoViewController *twoVC = [[TwoViewController alloc] initWithNibName:@"TwoViewController" bundle:nil];
    [twoVC setCurrentImage:self.currentImage];
[self.navigationController pushViewController:twoVC animated:YES];
}

Second Controller:

@interface TwoViewController ()
@property (nonatomic, strong) UIImage *currentImage;
@end

@implementation TwoViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

   UIImageViewAligned *imageAlign = [[UIImageViewAligned alloc] initWithFrame:CGRectMake(0, 0, 280, 280)];
[imageAlign setImage:self.currentImage]; 
imageAlign.contentMode = UIViewContentModeScaleAspectFit;
imageAlign.alignBottom = YES; //Not working!!!!! The image is center on UIImageView. My Image aspect ratio == UIViewContentModeScaleAspectFit
imageAlign.alignLeft = NO;
imageAlign.alignRight = NO;
imageAlign.alignTop = NO;
[self.viewContent addSubview:imageAlign];
[imageAlign setBackgroundColor:[UIColor greenColor]];
}

And I know the width and height of the image contained within the UIImageView

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants