Tag: cocoa touch

如何更改独立于tabbar项目标题的uiviewcontroller标题

我设置我的视图控制器标题像这样在视图中加载: self.title = @"my title"; 在此之前,我在视图控制器和导航控制器中embedded了故事板中的标题。我将它设置为:“标题”; 当我点击包含视图控制器的选项卡时,标签栏项目和uiviewcontroller标题变为:我的标题 我想为视图控制器来改变,但标签栏项留在标题:标题 我怎样才能做到这一点?

UISearchBar CGContext错误

我有一个视图内的UISearchBar,每当我点击它,键盘上来后 – 之后-(BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar 它发送到控制台: <错误>: CGContextSetStrokeColorWithColor :无效的上下文0x0 。 这是一个严重的错误。 此应用程序或其使用的库使用的是无效上下文,从而导致系统稳定性和可靠性的整体降级。 这个通知是礼貌的:请解决这个问题。 这将是即将到来的更新中的致命错误。 它重复相同的错误。 我想知道究竟是什么问题? 我相信有一个NULL的背景,但它与UISearchBar有什么关系? TNX。

“interfaceOrientation”在iOS 8中被弃用,如何改变这个方法Objective C

我从Cocoa Controls下载了一个使用这个方法的simpleCamera视图 – (AVCaptureVideoOrientation)orientationForConnection { AVCaptureVideoOrientation videoOrientation = AVCaptureVideoOrientationPortrait; switch (self.interfaceOrientation) { case UIInterfaceOrientationLandscapeLeft: videoOrientation = AVCaptureVideoOrientationLandscapeLeft; break; case UIInterfaceOrientationLandscapeRight: videoOrientation = AVCaptureVideoOrientationLandscapeRight; break; case UIInterfaceOrientationPortraitUpsideDown: videoOrientation = AVCaptureVideoOrientationPortraitUpsideDown; break; default: videoOrientation = AVCaptureVideoOrientationPortrait; break; } return videoOrientation; } 问题是“interfaceOrientation”在iOS 8弃用,但我不知道什么,以及如何在开关条件中取代这一点。

检测UITableView滚动

我已经分类UITableView(作为KRTableView),并实现了四个基于触摸的方法(touchesBegan,touchesEnded,touchesMoved和touchesCancelled),以便我可以检测到基于触摸的事件正在处理UITableView。 基本上我需要检测的是当UITableView向上或向下滚动时。 但是,UITableView的子类化和创build上述方法只会检测UITableViewCell中是否发生滚动或手指移动,而不是整个UITableView。 只要我的手指移动到下一个单元格,触摸事件就不会执行任何操作。 这是我如何inheritanceUITableView: #import "KRTableView.h" @implementation KRTableView – (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; NSLog(@"touches began…"); } – (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesMoved:touches withEvent:event]; NSLog(@"touchesMoved occured"); } – (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent *)event { [super touchesCancelled:touches withEvent:event]; NSLog(@"touchesCancelled occured"); } – (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; NSLog(@"A tap […]

如何从NSString获取单个NSString字符

我想从NSString的某个地方得到一个angular色。 我想要的结果是一个NSString。 这是我用来获取索引它的单个字符的代码: [[s substringToIndex:i] substringToIndex:1] 有没有更好的方法来做到这一点?

定义UISegmentedControl的点击事件

我在我的应用程序中添加了一个UISegmentedControl 。 在正常状态下,没有select任何button。 我想实现一个button点击事件,当第一个段被选中,另一个事件时,另一个button被点击。

UIEdgeInsets如何工作?

我正在做一个应用程序,我使用UIEdgeInsetsMake resizableImageWithCapInsets ,但我不明白它是如何工作的, UIEdgeInsetsMake有4个参数: 最佳 剩下 底部 对 但他们是浮动的,所以我不知道如何设置图像,谢谢! :d

如何定义UIColor的常量值?

我想要做这样的事情,但我不能得到一个合作的语法。 static const UIColor *colorNavbar = [UIColor colorWithRed: 197.0/255.0 green: 169.0/255.0 blue: 140.0/255.0 alpha: 1.0]; 我想我可以定义macros,但它们很丑。

UIImage上的圆angular

我试图在iPhone上使用圆angular来绘制图像,在联系人应用程序中使用联系人图像。 我已经得到了一般工作的代码,但它偶尔会在UIImage绘图例程中崩溃,并带有EXEC_BAD_ACCESS – KERN_INVALID_ADDRESS 。 我认为这可能与我几周前提出的裁剪问题有关,但是我相信我正确设置了裁剪path。 这里是我正在使用的代码 – 当它没有崩溃时,结果看起来很好,任何想要获得类似外观的人都可以自由地借用代码。 – (UIImage *)borderedImageWithRect: (CGRect)dstRect radius:(CGFloat)radius { UIImage *maskedImage = nil; radius = MIN(radius, .5 * MIN(CGRectGetWidth(dstRect), CGRectGetHeight(dstRect))); CGRect interiorRect = CGRectInset(dstRect, radius, radius); UIGraphicsBeginImageContext(dstRect.size); CGContextRef maskedContextRef = UIGraphicsGetCurrentContext(); CGContextSaveGState(maskedContextRef); CGMutablePathRef borderPath = CGPathCreateMutable(); CGPathAddArc(borderPath, NULL, CGRectGetMinX(interiorRect), CGRectGetMinY(interiorRect), radius, PNDegreeToRadian(180), PNDegreeToRadian(270), NO); CGPathAddArc(borderPath, NULL, CGRectGetMaxX(interiorRect), CGRectGetMinY(interiorRect), radius, […]

iOS 8 – 解除视图控制器与自定义演示文稿后的屏幕空白

当closures使用UIModalPresentationCustom各种视图控制器时,屏幕在视图控制器closures后变成黑色,就好像所有的视图控制器已经从视图层次中移除一样。 转换委托设置正确,animationControllerForPresentedController请求并正确传递,一旦animation结束,转换完成。 这个确切的代码在使用iOS 7 SDK进行编译时效果很好,但是在使用iOS 8b5编译时会被破坏