`
yourgame
  • 浏览: 355567 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论
文章列表
- (void)applicationDidFinishLaunching:(UIApplication *)application { NSString *nibTitle = @"PadContent"; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { nibTitle = @"PhoneContent"; } [[NSBundle mainBundle] loadNibNamed:nibTitle owner:self optio ...
NSString * fruits = @"apple,pair,banana,orange"; NSArray * array= [fruits componentsSeparatedByString:@","];
NSFileManager *m = [NSFileManager defaultManager]; NSArray *fileList = [m directoryContentsAtPath:[[[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"163"] ...
//在iPhone里面最讨厌的控件之一就是UINavigationBar了。这个控件样式修改不方便,连添加按钮也特别麻烦。下面的例子是如何手动添加带箭头的按钮: UINavigationItem * item = [navBar.items objectAtIndex: 0]; UINavigationItem * back = [[UINavigationItem alloc] initWithTitle: @"Back"]; NSArray * items = [[NSArray alloc] initWithObjects: back,item,nil]; [n ...
代码如下 //设置layer CALayer *layer=[backView layer]; //是否设置边框以及是否可见 [layer setMasksToBounds:YES]; //设置边框圆角的弧度 [layer setCornerRadius:10.0]; //设置边框线的宽 // [layer setBorderWidth:1]; //设置边框线的颜色 [layer setBorderColor:[[UIColor blackColor] CGColor]]; ...
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"]; NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"]; [formatter setTimeZone:timeZone]; NSString *loctime = [formatter stringFromDate:date]; [for ...
-(UIImage * ) generatePhotoThumbnail: (UIImage * ) image { // Create a thumbnail version of the image for the event object. CGSize size = image.size; CGSize croppedSize; CGFloat ratio = 64.0; //这个是设置转换后图片的尺寸大小 CGFloat offsetX = 0.0; CGFloat offsetY = 0.0; // che ...
//设置UIImageView的对象的以下两个属性,可以图片不变形且充满图片框为前提进行填充。 imageview.clipsToBounds = YES; imageview.contentMode = UIViewContentModeScaleAspectFill; 转载自:http://blog.sina.com.cn/s/blog_699ebf3d0100oa39.html
tag 是一个整型,那么就意味着可以放任何东西。怎么放喃,放对象指针。例如 // 放字符串 NSString* str = [[NSString alloc] stringByAppendingString:@"内容"]; [button setTag:(int)str]; // 放自定义数据 NSCustomClass* cls = [[NSCustomClass alloc] init:@"",@"",@""]; [button s ...
UITableView *tv = (UITableView *) self.superview; SuperMarketViewController *vc = (SuperMarketViewController *) tv.dataSource;
默认情况下UIImageView是不支持事件的,要想给他加事件比较麻烦,通过在类中定义下面的方法就可以方便的位UIImageView加事件 imageTaped方法会被调用,在方法中做要处理的内容。 - (void) addGestureRecognizer:(UIImageView *)imageView{ UITapGestureRecognizer *singleTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@ ...
jqTransform是一个web界面美化的jquery插件,实用过程中发现对select赋值后,他美化后的下拉框不变化,研究了一下源码。增加如下代码即可修复bug //这样当我们 $('#select').val('abc');的时候就正常了。否则select的值变化了。但是显示的ui不变化。 $('select.jqTransformHidden').live('change',function(){ var thiz = $(this); var text = thiz.find('option:selected').text(); var ul = thiz.p ...
/* performSelector:withObject:afterDelay: Invokes a method of the receiver on the current thread using the default mode after a delay. - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay Parameters aSelector A selector that identifies the method ...
//sdk中提供了方法可以直接调用 UIImage *img = [UIImage imageNamed:@"some.png"]; NSData *dataObj = UIImageJPEGRepresentation(img, 1.0); //下面是sdk中UIImage.h头文件中的内容 UIKIT_EXTERN NSData *UIImagePNGRepresentation(UIImage *image); // return image as PNG. May return nil if ...
//通过执行下面的代码可以动态设定程序的状态栏和导航栏的样式 [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent; self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
Global site tag (gtag.js) - Google Analytics