0

2つの画像を統合する方法。一方はデフォルトとして機能し、もう一方はアプリの起動時にアニメーション画像として機能します。アニメーション画像は、ビューが再度読み込まれた場合でも再び表示されないようにする必要があります。アプリがdefault.png画像のように起動した場合にのみ表示されます。 2つのデフォルト画像を取得することです..どうすればそれを行うことができますか?..

これが私のコードです...

@interface ViewController ()<UIActionSheetDelegate>

@property (nonatomic, assign) BOOL useButtons;

@end

@implementation ViewController

 @synthesize carousel,Chaintop;

#pragma mark -
#pragma mark View lifecycle

  - (void)viewDidLoad
 {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
carousel.type = iCarouselTypeInvertedWheel              ;

CGRect ChaintopFrame = Chaintop.frame;
ChaintopFrame.origin.y = self.view.bounds.size.height;    

[UIView animateWithDuration:3
                      delay:1.0
                    options: UIViewAnimationCurveEaseOut
                 animations:^{
                  Chaintop.frame = ChaintopFrame;
                     //Chainbottom.frame = ChainbottomFrame;
                 } 
                 completion:^(BOOL finished){
                     NSLog(@"Done!");
                 }];
   [self.view addSubview: Chaintop];
   }


 - (void)viewDidUnload
 {
[super viewDidUnload];
 // Release any retained subviews of the main view.
}

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

    - (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
    {
   return NUMBER_OF_ITEMS;
      }

  - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
  {

   UIImage *buttonImage=[NSArray arrayWithObjects:[UIImage imageNamed:@"Cover_0.png"],
                      [UIImage imageNamed:@"Cover_1.png"],
                      [UIImage imageNamed:@"Cover_2.png"],
                      [UIImage imageNamed:@"Cover_3.png"],
                      [UIImage imageNamed:@"Cover_4.png"],
                      [UIImage imageNamed:@"Cover_5.png"],
                      [UIImage imageNamed:@"Cover_6.png"],
                      [UIImage imageNamed:@"Cover_7.png"],nil];

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, 200.0f, 200.0f);

[button setImage:(UIImage*)[buttonImage objectAtIndex:index] forState:UIControlStateNormal]; 

[button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
return button;



 }

 -(void)dealloc{
[Chaintop release];

 }



 - (BOOL)carousel:(iCarousel *)_carousel shouldSelectItemAtIndex:(NSInteger)index
   {
if (index == carousel.currentItemIndex)
{
    NSLog(@"Should select current item");
}
else
{
    NSLog(@"Should select item number %i", index);
}
return YES;
  }

  - (void)carousel:(iCarousel *)_carousel didSelectItemAtIndex:(NSInteger)index
  {
if (index == carousel.currentItemIndex)
{
    //note, this will only ever happen if useButtons == NO
    //otherwise the button intercepts the tap event
    NSLog(@"Did select current item");
}
else
{
    NSLog(@"Did select item number %i", index);
}
     }
     @end
4

1 に答える 1

2

あなたのAPP DELEGATE。このような何かが仕事をするはずです:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    UIImageView *imageView = [[[UIImageView alloc] initWithFrame:self.window.bounds] autorelease];
    UIImage *image = [UIImage imageNamed:@"NAMEOFYOURSPLASHSCREEN.png"];
    imageView.image = image;
    [self.window addSubview:imageView];
    [self.window makeKeyAndVisible];
    [self performSelector:@selector(remove1stSplash:) withObject:imageView afterDelay:5];
    return YES;
}

- (void)remove1stSplash:(UIImageView *)1stView {
    UIImageView *imageView = ...
    [self.window addSubview:imageView];
    [self performSelector:@selector(remove2ndSplash:) withObject:imageView afterDelay:5];
    [1stView removeFromSuperView];
}

- (void)remove2ndSplash:(UIImageView *)2ndView {
    [self.window addSubview:.....
    [2ndView removeFromSuperView];
}

編集:

サンプルプロジェクトへのリンク: iPhoneの2つのスプラッシュ画面表示

于 2012-06-28T16:40:53.880 に答える