知识积累
来源:互联网 发布:淘宝货源 编辑:程序博客网 时间:2024/06/10 16:42
- [[UIScreen mainScreen] bounds];
2.返回整个屏幕的可显示区域
- [[UIScreen mainScreen] applicationFrame];
3.延迟调用自己的方法
- - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay;
4.定时器(每隔一定时间调用些方法)
- + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo;
5.隐藏任务栏
- [[UIApplication sharedApplication] setStatusBarHidden:YES];
6.得到应用程序路径
- NSHomeDirectory()
7.网络活动指示器
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
8.暂停一秒钟
- [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0f]];
9.设置标准VIEW角边为圆角
- 加入QuartzCore.frameworl
- #import <QuartzCore/QuartzCore.h>
- [webView.layer setCornerRadius:15.0f];
- [webView.layer setMasksToBounds:YES];
10.给UIView添加图片
- view.layer.contents = (id)[UIImage imageNamed:@"tc_pop_content_view.png"].CGImage;
11.角度换算成弧度
- 公式 M * 3.14159 / 180
- 例:M = 45度
- 弧度值:大约0.7853
- double radians(float degrees){
- return (degrees * 3.14159265) / 180.0;
- }
Class musicClass = (NSClassFromString(@"MPMusicPlayerController"));
if (musicClass !=nil) {
MFMailComposeViewController
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (([[[request URL] scheme] isEqualToString: @"http"] ||
[[[request URL] scheme] isEqualToString: @"https"] ||
[[[request URL] scheme] isEqualToString: @"mailto"])
&& (navigationType ==UIWebViewNavigationTypeLinkClicked)) {
return ![[UIApplication sharedApplication] openURL:[request URL]];
}
returnYES;
}
self.bounds =CGRectInset([selfbounds],0.1,0.1);
self.contentsScale =1;
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStoragesharedHTTPCookieStorage];
for (cookie in [storage cookies]) {
[storagedeleteCookie:cookie];
}
#import<AudioToolbox/AudioToolbox.h>
[[UIApplicationsharedApplication]beginReceivingRemoteControlEvents];
[[AVAudioSession sharedInstance]setDelegate:self];
[[AVAudioSession sharedInstance]setCategory:AVAudioSessionCategoryPlaybackerror:nil];
[[AVAudioSession sharedInstance]setActive:YESerror:nil];
18.播放系统提示音
//1
NSString *soundPath = [[NSBundlemainBundle]pathForResource:@"tishi"ofType:@"caf"];
NSURL *musicURL=[[NSURLalloc]initFileURLWithPath:soundPath];
thePlayer = [[AVAudioPlayeralloc]initWithContentsOfURL:musicURLerror:nil];
[thePlayersetDelegate:self];
[musicURL release];
[thePlayersetVolume:1.0f];
[thePlayerplay];
//2
SystemSoundID soundID;
NSString *path = [[NSBundlemainBundle]pathForResource:@"tishi"ofType:@"caf"];
CFURLRef soundURL = (CFURLRef)[NSURLfileURLWithPath:path];
AudioServicesCreateSystemSoundID(soundURL,&soundID);
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
AudioServicesPlayAlertSound(soundID);
srand((unsigned)time(NULL)); //以时间作为参照标准
for (int i = 1 ; i <= 10; i++) {
NSLog(@"%d",rand() %100 +1);
}
// for (int i = 0; i < data.length; i++) {
//
// printf("(%x,%d)",receiveByte[i],receiveByte[i]);
//
// int n = receiveByte[i];
//
// int i=0,a[8];
// //辗转相除取模
// do {
// a[i]=n%2;
// n/=2;
// i++;
// }while(n!=0);
//
// for(i--;i>=0;i--)
// printf("%i",a[i]);
//
// printf("\n");
// }
// printf("\r\n");
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- 知识积累。。
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- 知识积累
- [知识积累] 技术框架积累
- 知识的积累(引)
- 把NSString用C的方法分析
- RCP开发异常之org.eclipse.core.runtime.CoreException
- python copy详解
- android apk的反编译
- iPhone开发问题
- 知识积累
- DevExpress Asp.net ASPxTreeList的基本使用之一
- No statements may be issued when any streaming result sets are open and in use on a given connection
- MySQL+Replication(复制)基本原理
- java操作excel,pdf的方法
- .net中的break、continue、return之间的区别
- socket中send函数和recv函数
- iPhone 开发过程中的一些小技术的总结
- JSFL导出FLA中的文本内容