Не можете добавить UIImageView? - PullRequest
0 голосов
/ 21 апреля 2011

Я пытаюсь добавить изображение на мой взгляд, что в UIScrollView

вот мой .h

@interface NormalDetail : UIViewController <UIScrollViewDelegate> {   
    IBOutlet UIImageView *lineImg;
}

@property (nonatomic, retain) UIImageView *lineImg;

@end

и вот мой.m

- (void)viewDidLoad
{
    [super viewDidLoad];
    //Set ScrollView
    scrollView.contentSize = CGSizeMake(320.0f, 1800.0f); 
    //End Set ScrollView
    [self setupTextView];
}


- (void) setupTextView
{
    textDescription.scrollEnabled = NO;
    NSString *foo = @"Hello Test";
    textDescription.text = foo;
    /*Here is something for dynamic textview*/
    CGRect frame;
    frame = textDescription.frame;
    frame.size.height = [textDescription contentSize].height;
    textDescription.frame = frame;
     /**/

    int linePosition = frame.size.height+20;
    lineImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"line.png"]];
    CGRect line2Frame = CGRectMake(-8, 600, 328, 10);
    lineImg.frame = line2Frame;
}

Что не так с моим кодом, моя картинка не появилась.помогите мне пожалуйста; (

1 Ответ

2 голосов
/ 21 апреля 2011

Вам понадобится UIImageView для scorllView.

- (void) setupTextView
{
    textDescription.scrollEnabled = NO;
    NSString *foo = @"Hello Test";
    textDescription.text = foo;
    /*Here is something for dynamic textview*/
    CGRect frame;
    frame = textDescription.frame;
    frame.size.height = [textDescription contentSize].height;
    textDescription.frame = frame;
     /**/

    int linePosition = frame.size.height+20;
    lineImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"line.png"]];
    CGRect line2Frame = CGRectMake(-8, 600, 328, 10);
    lineImg.frame = line2Frame;

     //Add the image view as a subview to yout scrollview.
    [scrollView addSubView:lineImg];
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...