ios note

.h==================================================================

 

#import <UIKit/UIKit.h>

 

@interface t5ViewController : UIViewController <UIAlertViewDelegate, UIActionSheetDelegate>{

    IBOutlet UIImageView *imageView;

    IBOutlet UIPageControl *pageControl;

    IBOutlet UIWebView *webView;

}

 

@property (nonatomic, retain) UIWebView *webView;

@property (nonatomic, retain) UIImageView *imageView;

@property (nonatomic, retain) UIPageControl *pageControl;

 

 

@end

 

 

 

 

 

.m===================================================================

 

 

#import "t5ViewController.h"

 

@implementation t5ViewController

 

@synthesize imageView;

@synthesize pageControl;

@synthesize webView;

- (void)dealloc

{

    [super dealloc];

}

 

- (void)didReceiveMemoryWarning

{

    // Releases the view if it doesn't have a superview.

    [super didReceiveMemoryWarning];

   

    // Release any cached data, images, etc that aren't in use.

}

 

#pragma mark - View lifecycle

 

-(void) pageTurning : (UIPageControl *) pageController{

    NSLog(@"current page : %d", [pageController currentPage]);

    switch([pageController currentPage]){

        case 0:

            [imageView setImage:[UIImage imageNamed:@"s1.png"]]; break;

        case 1:

            [imageView setImage:[UIImage imageNamed:@"s2.jpg"]]; break;

        default:

            [imageView setImage:[UIImage imageNamed:@"s3.jpg"]]; break;

 

 

    }

}

 

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

- (void)viewDidLoad

{

   

    [super viewDidLoad];

   

    UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"TTTitle" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"xxx" otherButtonTitles:@"HHHHHHH", nil];

    [sheet showInView:self.view];

    [sheet release];

 

   

   

    UIAlertView *v = [[UIAlertView alloc]

                      initWithTitle:@"Hi" message:@"welcome to china" delegate:self cancelButtonTitle:@"quit" otherButtonTitles:@"xxx", nil];

    [v show];

    [v release];

   

   

   

    [imageView setImage:[UIImage imageNamed:@"s1.png"]];

    [imageView setHighlighted:false];

    [pageControl addTarget:self action:@selector(pageTurning:) forControlEvents:UIControlEventValueChanged];

   

    NSURL *url = [NSURL URLWithString:@"http://www.baidu.com"];

    NSURLRequest *req = [NSURLRequest requestWithURL:url];

    [webView loadRequest:req];

   

   

}

 

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

    NSLog(@"hello, %d", buttonIndex);

    if(buttonIndex == 1){

        NSLog(@"press xxx");

    }else if(buttonIndex == 0)

        NSLog(@"pressed qqqqqqqquit");

   

   

}

 

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{

    NSLog(@"pppppppppppppressed actionsheet, %d", buttonIndex);

}

 

 

- (void)viewDidUnload

{

    [super viewDidUnload];

    // Release any retained subviews of the main view.

    // e.g. self.myOutlet = nil;

}

 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{

    // Return YES for supported orientations

    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

 

@end

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值