自定义表格视图行动(图片)

我的应用程序包括一个UITableView。 它的单元格可以select显示多行。 单元格也有自定义的行动(图片)。 我像这样设置了行动图像: let date = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "", handler: { (action, indexPath) -> Void in}) date.backgroundColor = UIColor(patternImage: UIImage(named: "rowActionPic")!) 该图像的分辨率为122×94。 如果单元格显示一行,则全部适合完美。 如果单元格显示2行或更多行,则图像将显示2次。 有没有select中心的形象? cellForRowAtIndexPath代码: cell.textLabel?.numberOfLines = 0 let object = self.fetchedResultsController.objectAtIndexPath(indexPath) as! NSManagedObject cell.textLabel?.text = object.valueForKey("name") as? String

如何以编程方式从iOS设备获取自己的手机号码?

我想为我的应用程序获取我自己的联系人号码。 我已经阅读了堆栈溢出的一些答案,但那些是旧的。 所以请根据苹果的新指引告诉我,我们可以拿到手机号码吗? 谢谢

使用UIDynamicAnimator水平animationUIView

我已经通过了文档,我很尴尬地说我很困惑。 场景 : 我有一个UIView ,就像一个容器3 UIButtons 。 这个容器最初是边界{0, 0, 35, 35} ,每个button里面都有相同的坐标(用alpha 0)。 在用户的特定操作中,容器将边界改变为{0, 0, 100, 35} ,并且button被dynamic地分配给x-原点5,35和65,其中alpha被分散在resize的容器内。 我把这称为容器的扩展状态 。 用户执行相同的操作,将其切换回原始合同状态 。 目标 : 我目前正在使用[UIView animateWithDuration:]块来做这个,但是想使用UIDynamicAnimator来添加一个弹性效果,例如当切换到展开状态时,容器resize并弹跳(resize并反弹回到目标范围),button弹跳(进一步移动,并弹回到目标范围)。 混乱 : UIDynamicAnimator , UIDynamicBehavior , UIAttachmentBehavior , UIDynamicItem …..所有这些都使我对UIKitDynamic理解溢出了。 我想我应该使用UISnapBehavior ,但我不知道如何去做。

更改键盘语言

可能重复: 设置iPhone键盘语言 在我的iPhone应用程序中,我想要将键盘的语言从英文更改为简体中文。 请帮帮我。

UIScrollView并取消缩放缩放手势

如何强行取消UIScrollView上的缩放打开捏手势,比方说当用户放大到足够远以触发新的动作时?

在一段时间后显示UIAlertView

我试图显示一段时间后UIAlertView(如在应用程序中做了5分钟后)。 我已经通知用户,如果应用程序closures或在后台。 但是我想在应用程序运行时显示一个UIAlertView。 我试图dispatch_async如下,但警报是永远popup: [NSThread sleepForTimeInterval:minutes]; dispatch_async(dispatch_get_main_queue(), ^{ UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"title!" message:@"message!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } ); 另外,我读了30到60分钟后线头死亡。 我希望能够在超过60分钟后显示警报。

如何覆盖/ swizzle在运行时的私人类的方法objective-c?

给我一点为什么我问这个问题的背景:基本上我想改变iOS的谷歌地图的myLocationButton的位置。 所以我首先获取像这样的实际button: @implementation GMSMapView (UIChanges) – (UIButton *)myLocationButton { UIButton *myLocationButton; for (myLocationButton in [settingView subviews]) { if ([myLocationButton isMemberOfClass:[UIButton class]]) break; } return myLocationButton; } 然后,我尝试改变它在屏幕上的位置使用NSLayoutConstraints(直接更改button的frame属性的值没有任何与谷歌地图SDK 1.8 +): UIButton *myLocationButton = [mapView_ myLocationButton]; [myLocationButton setTranslatesAutoresizingMaskIntoConstraints:NO]; [myLocationButton constraintRightEqualTo:[myLocationButton superview] constant:0]; [myLocationButton constraintTopEqualTo:[myLocationButton superview] constant:50]; 其中constraintRightEqualTo在类别中定义为: – (void)constraintRightEqualTo:(UIView *)toView constant:(CGFloat)constant { NSLayoutConstraint *cn = [NSLayoutConstraint constraintWithItem:self […]

MPMoviePlayerControlle thumbnailImageAtTime:timeOption:给出空的UIImage

我使用这个来获得video的预览缩略图: – (void)createThumb { NSInteger paddingLeft = 22; NSInteger paddingTop = 22; CGFloat frameWidth = self.preview.frame.size.width – (2 * paddingLeft); CGFloat frameHeight = self.preview.frame.size.height – (2 * paddingTop); CGSize size = CGSizeMake(frameWidth, frameHeight); MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:self.fileUrl]; NSLog(@"File url %@",self.fileUrl); UIImage *thumbnail = [mp thumbnailImageAtTime:0.0 timeOption:MPMovieTimeOptionNearestKeyFrame]; [mp stop]; [mp release]; if (!thumbnail){ thumbnail […]

UIPickerView与DONEbutton

我在我的应用程序中有一个UIPickerView ,我想要一个完成button来隐藏select器。 我不想使用一个操作表,因为我想关注其余的view.i意味着所有的视图必须是活动的。 以下是我如何创buildselect器: UIPickerView *pickerViewCountry = [[UIPickerView alloc] init]; pickerViewCountry.showsSelectionIndicator = YES; pickerViewCountry.dataSource = self; pickerViewCountry.delegate = self; pickerViewCountry.frame = CGRectMake(0,210 , 320, 15); [self.view addSubview:pickerViewCountry]; [pickerViewCountry release];

给框架设定器正确的行间距调整

几个post已经注意到了从CTFramesetterSuggestFrameSizeWithConstraints得到一个确切的高度,在这里, (framesetter post) ,@Chris DeSalvo给出了看起来像权威性的修复:添加一个段落风格设置与正确的行距调整。 DeSalvo通过从其lineHeight移除UIFont的上行和下行来获得他的“领导”。 我想知道如何比较CTFontGetLeading 。 我使用像这样创build的字体: CTFontRef fontr = CTFontCreateWithName((CFStringRef)@"Helvetica Neue", 16.0f, NULL); UIFont *font = [UIFont fontWithName:@"Helvetica Neue" size:16.0f]; 价值是非常不同的: 0.448 CTFontGetLeading 2.360 DeSalvo的公式:UIFont lineHeight – ascender + descender 以下是一些其他UIFont值: 21.000 UIFont的lineHeight 15.232 UIFont的上升(从基线起的Y坐标) -3.408 UIFont的下行(从基线起的Y坐标) 08.368 UIFont的xHeight 以下是Ken Thomases询问的CTFont值: 11.568001 CTFontGetCapHeight 08.368 CTFontGetXHeight -15.216001,-7.696001,38.352001,24.928001 CTFontGetBoundingBox 15.232 CTFontGetAscent 03.408 CTFontGetDescent(class ref是指“根据字体大小和字体引用matrix缩放的缩放字体下降度量” […]