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

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


{


        NSURL  *picUrl = [NSURL URLWithString:url];


        NSData *picData = [NSData dataWithContentsOfURL:picUrl];


        UIImage *image = [UIImage imageWithData:picData];


        return image;


}


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


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



iphone中怎么把button做成圆形的

UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom]];
        UIImage *image = [UIImage imageNamed:@"xxx.png"];
        [button setBackgroundImage:image 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*   imagesView;
        NSMutableArray*       imageList;
        id<WelComeDelegate>   m_delegate;
        NSTimer*              m_timer;
}
@property(nonatomic,retain)NSTimer*              m_timer;
@property(nonatomic,retain)UIImageView*          imagesView;
@property(nonatomic,retain)NSMutableArray*       imageList;
@property (nonatomic, assign) id <WelComeDelegate> m_delegate;
-(void)displayImage:(NSArray*)images;
-(void)displayImage;
@end

@protocol WelComeDelegate 
- (void)animateDidFinish;
@end

完整截屏功能的实现

CGImageRef UIGetScreenImage();
void SaveScreenImage(NSString *path)
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    CGImageRef cgImage = UIGetScreenImage();
        void *imageBytes = NULL;
        if (cgImage == NULL) {
                CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
                imageBytes = malloc(320 * 480 * 4);
                CGContextRef context = CGBitmapContextCreate(imageBytes, 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 imageWithCGImage:cgImage]);
    CGImageRelease(cgImage);
        if (imageBytes)
                free(imageBytes);
    [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 imageNamed:@"DoneUp.png"] forState:UIControlStateNormal];

    [doneButton setImage:[UIImage imageNamed:@"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