iphone中怎么样通过网络下载图片、显示

-(UIImage*)loadImageFromUrl:(NSString*)url


{


        NSURL  *picUrl = [NSURL URLWithString:url];


        NSData *picData = [NSData dataWithContentsOfURL:picUrl];


        UIImage *p_w_picpath = [UIImage p_w_picpathWithData:picData];


        return p_w_picpath;


}


然后你的UIImageView.imge =这返回的图片


如果页面已经呈现了,你的UiImageView调用setNeedsDisplay方法就可以刷新了



iphone中怎么把button做成圆形的
UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom]];
        UIImage *p_w_picpath = [UIImage p_w_picpathNamed:@"xxx.png"];
        [button setBackgroundImage:p_w_picpath forState:UIControlStateNormal];
图片选张圆型的就可以了
如果在xib中拖出来的按钮,就把Type设为custom,然后在BackImage里选张圆型图片
这图片需要事先添加进Resources里

iphone程序的启动图像如何做成动态的
自己做个UIView,这上面放UIImageView来代替Default.png
#import <UIKit/UIKit.h>
#define   kImageWidth   303
#define   kImageHeight  58
#define   kImageCount   6

@protocol WelComeDelegate;

@interface WelComeViewController : UIViewController
{
        UIImageView*   p_w_picpathsView;
        NSMutableArray*       p_w_picpathList;
        id<WelComeDelegate>   m_delegate;
        NSTimer*              m_timer;
}
@property(nonatomic,retain)NSTimer*              m_timer;
@property(nonatomic,retain)UIImageView*          p_w_picpathsView;
@property(nonatomic,retain)NSMutableArray*       p_w_picpathList;
@property (nonatomic, assign) id <WelComeDelegate> m_delegate;
-(void)displayImage:(NSArray*)p_w_picpaths;
-(void)displayImage;
@end

@protocol WelComeDelegate 
- (void)animateDidFinish;
@end

完整截屏功能的实现
CGImageRef UIGetScreenImage();
void SaveScreenImage(NSString *path)
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    CGImageRef cgImage = UIGetScreenImage();
        void *p_w_picpathBytes = NULL;
        if (cgImage == NULL) {
                CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
                p_w_picpathBytes = malloc(320 * 480 * 4);
                CGContextRef context = CGBitmapContextCreate(p_w_picpathBytes, 320, 480, 8, 320 * 4, colorspace, kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big);
                CGColorSpaceRelease(colorspace);
                for (UIWindow *window in [[UIApplication sharedApplication] windows]) {
                        CGRect bounds = [window bounds];
                        CALayer *layer = [window layer];
                        CGContextSaveGState(context);
                        if ([layer contentsAreFlipped]) {
                                CGContextTranslateCTM(context, 0.0f, bounds.size.height);
                                CGContextScaleCTM(context, 1.0f, -1.0f);
                        }
                        [layer renderInContext:(CGContextRef)context];
                        CGContextRestoreGState(context);
                }
                cgImage = CGBitmapContextCreateImage(context);
                CGContextRelease(context);
        }
    NSData *pngData = UIImagePNGRepresentation([UIImage p_w_picpathWithCGImage:cgImage]);
    CGImageRelease(cgImage);
        if (p_w_picpathBytes)
                free(p_w_picpathBytes);
    [pngData writeToFile:path atomically:YES];
    [pool release];
}
在警告视图中添加文本框
- (void)viewDidLoad {

[super viewDidLoad];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@”Enter Name Here” message:@”this gets covered!”

delegate:self cancelButtonTitle:@”Dismiss” otherButtonTitles:@”OK!”, nil];

UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)];

[myTextField setBackgroundColor:[UIColor whiteColor]];

[alert addSubview:myTextField];

[alert show];

[alert release];

[myTextField release];

数字键盘消失
自己在loadview里定义一个观察者如(

[[NSNotificationCenter defaultCenter] addObserver:self 

                                             selector:@selector(keyboardWillShow:) 

                                                 name:UIKeyboardDidShowNotification

                                               object:nil];

图片自己选择合适大小

- (void)keyboardWillShow:(NSNotification *)note {  

    // create custom button

    UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];

    doneButton.frame = CGRectMake(0, 163, 106, 53);

    doneButton.adjustsImageWhenHighlighted = NO;

    [doneButton setImage:[UIImage p_w_picpathNamed:@"DoneUp.png"] forState:UIControlStateNormal];

    [doneButton setImage:[UIImage p_w_picpathNamed:@"DoneDown.png"] forState:UIControlStateHighlighted];

    [doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];


    // locate keyboard view

    UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];

    UIView* keyboard;

    for(int i=0; i<[tempWindow.subviews count]; i++) {

        keyboard = [tempWindow.subviews objectAtIndex:i];

        // keyboard view found; add the custom button to it

        

if(([[keyboard description] hasPrefix:@"<UIPeripheralHostView"] == YES) ||(([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)))

            [keyboard addSubview:doneButton];

    }

}

 
如何获取本地的音乐文件
1。把文件加载到程序
2。头文件
       #import <AVFoundation/AVFoundation.h>
       AVAudioPlayer *audioPlayer;
    
    NSString *name  =[[NSString alloc]initWithFormat:@"1-welcome"];//the name of your music file
    NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:name ofType:@"wav"];
    NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:soundFilePath]; 
    AVAudioPlayer *myaudioPlayer  = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error :nil];
    [myaudioPlayer play];
    [fileURL release];

      记得释放autoPlayer