1

代替テキスト

このようなデザインを作成することは可能ですか?これに関するヘルプは私にとって非常に役立ちます。私が望む機能は、時間を選択するためにホイールを左から右または右から左に回転させることです...黄色は選択色で、赤はカウントダウンの実行中の残り時間を示しています

4

3 に答える 3

1

私のビデオを参照して ください http://www.youtube.com/watch?v=4acFshAlGJ8

https://lh3.googleusercontent.com/-WZEDMSmfrK0/TeeD93t8qYI/AAAAAAAAAKw/X9D6jRkLfLk/s800/MUKScale.png 画像を scrollView の Scale として使用しています 。これは、どのように達成できるかを示すための不完全な例です。

ここにいくつかの役立つコードがあります。この近似ではすべてが静的ですが、実際の作業ではもっと作業する必要があります。

   - (void)viewDidLoad {
    [super viewDidLoad];

    [self.view addSubview:scrollView];

    UIImageView *backImgg = [[UIImageView alloc] initWithFrame:CGRectMake(x,y,886,15)];
    [backImgg setImage: [UIImage imageNamed:@"MUKScale.png"]];//Image in the link above
    [scrollView addSubview:backImgg];
    [backImgg release]; 

    [scrollView setContentSize:CGSizeMake(886,15)];
    return;
}

NSTimer *timer ;
float timeSet =0 ;
-(IBAction) btnPressed
{
timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(showTimeInLbl) userInfo:nil repeats:YES];
}

-(void)showTimeInLbl
{
    CGRect visibleRect;
    visibleRect.origin = scrollView.contentOffset;
    visibleRect.size = scrollView.contentSize;
    NSLog( @"Visible rect: %@", NSStringFromCGRect(visibleRect) );


    float time = visibleRect.origin.x / 8;
    timeSet = time;
    lblTime.text = [NSString stringWithFormat:@"%f",time];

    [UIView animateWithDuration: .1
                     animations: ^{
                         [scrollView setContentOffset:CGPointMake(visibleRect.origin.x - 8,0) animated:NO];
                     }completion: ^(BOOL finished){

                     }
     ];


    timeSet-=0.1;

    lblTime.text = [NSString stringWithFormat:@"%f",timeSet];

    if(timeSet<=0)
    {
        [timer invalidate];
        lblTime.text = @"0";

        [UIView animateWithDuration: .1
                         animations: ^{
                             [scrollView setContentOffset:CGPointMake(0,0) animated:NO];
                         }completion: ^(BOOL finished){

                         }
         ];
    }

}
于 2011-06-02T13:04:30.873 に答える
1

ギャラリー ビュー オブジェクトを使用します。水平方向にスクロールしたい画像で埋めるだけです。これは、達成しようとしているものの良い概算になります。

于 2010-06-24T15:08:05.047 に答える
0

Never Ended scrollView を使用できます(たとえば、これはオフページングのように含まれています)。これにより、スケールを実現し、スクロールビューのページ番号または座標を使用して、上に表示するスケールの読み取り値を見つけることができます。

開始カウントダウンで、UIView contentOffset CGPointMake(10, 100) のアニメーションを作成します。

例えば:

[UIView animateWithDuration: 1.5 /* Give Duration which was also on top */
                 animations: ^{
                     [scrollView setContentOffset:CGPointMake(0,0) animated:NO];
                 }completion: ^(BOOL finished){          }];
于 2011-06-01T08:13:03.883 に答える