1

を使用した iPhone アプリ開発での自動サイズ変更の問題に直面していCGRectMakeます。誰もそれについて説明できますか?

CGRect imgframe=CGRectMake(0, 0, 320, 283);
UIImageView *imgview=[[UIImageView alloc]initWithFrame:imgframe];
 KMAppDelegate *app=(KMAppDelegate *)[[UIApplication sharedApplication]delegate];
 [imgview setAutoresizingMask:UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight];
imgview.image=[UIImage imageNamed:app.imgString];
4

2 に答える 2

1

あなたはこのコードを試してみてください..それはあなたを助けるかもしれません..

    imgview =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 283)];
    KMAppDelegate *app=(KMAppDelegate *)[[UIApplication sharedApplication]delegate];
 [imgview setAutoresizingMask:UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight];
imgview.image=[UIImage imageNamed:app.imgString];
    imgview.contentMode = UIViewContentModeScaleAspectFit;

コーディングを楽しんでください..

于 2013-03-21T10:43:05.933 に答える
0
  CGRect imgframe=CGRectMake(0, 0, 320, 283);
    UIImageView *imgview=[[UIImageView alloc]initWithFrame:imgframe];
    KMAppDelegate *app=(KMAppDelegate *)[[UIApplication sharedApplication]delegate];
    [imgview setAutoresizingMask:UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight];
    imgview.image=[UIImage imageNamed:app.imgString];
    imgview.contentMode = UIViewContentModeScaleAspectFit;
    [[self view] addSubview:imgview] ;
于 2013-03-21T10:47:47.367 に答える