Tag: ios7

UIAlertView与文本框和三个button问题在iOS 6

UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Enter Student Name" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Save", @"Save and Add", nil]; alert.tag = 1; alert.transform=CGAffineTransformMakeScale(1.0, 0.75); alert.alertViewStyle=UIAlertViewStylePlainTextInput; [alert show]; -(void)willPresentAlertView:(UIAlertView *)alertView { if (alertView.tag == 1) { for (UIView *view in alertView.subviews) { if ([view isKindOfClass:[UITextField class]]|| [view isKindOfClass:[UIButton class]] || view.frame.size.height==31) { CGRect rect=view.frame; rect.origin.y += 65; view.frame = […]

计算dynamicUILabel(iOS7)的行数

这个问题有很多解决scheme,但找不到不被弃用的问题。 我有一个模式WordWrap UMLabel和固定的宽度,比方说250.行被设置为0。 这是我试过的: UILabel *contentLabel = (UILabel*)[contentView viewWithTag:10]; CGSize size = [contentLabel.text sizeWithFont:contentLabel.font forWidth:contentLabel.frame.size.width lineBreakMode:NSLineBreakByWordWrapping]; NSLog(@"Label's height is: %d", size.height); 高度参数的输出总是20(所以就像一条线),而te文本是30条线。 我需要为UIScrollView的目的。

无法使用内部使用.xib文件的iOS框架

我正在尝试通过以下URL中指定的步骤为iOS创build通用框架: Universal-framework-iOS 我有一个viewController类,内部加载.xib文件的框架。 下面是代码的一部分,它显示了我如何初始化viewController并显示相关视图: /*** Part of implementation of SomeViewController class, which is outside the framework ***/ – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.viewControllerWithinFramework = [[ViewControllerWithinFramework alloc] initWithTitle:@"My custom view"]; } – (IBAction)showSomeView:(id)sender { [self.viewControllerWithinFramework showRelatedView]; } /*** Part of implementation of ViewControllerWithinFramework […]

在调用completeTransition之后,导航栏被调整:在自定义转换中

我的目标是在启动应用程序时从类似于跳板图标的视图中为用户提供缩放模式转换。 所呈现的视图控制器正确放大,但导航栏在状态栏下的位置错误。 调用[transitionContext completeTransition:finished]后,该位置得到纠正。 如何从转换开始就使它正确无误? 这是一个屏幕logging的错误:http: //youtu.be/7LKU4lzb-uw (故障是在第六秒的logging) UIViewControllerAnimatedTransitioning代码: – (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext { UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; UIView *container = [transitionContext containerView]; CGPoint viewCenter = self.view.center; CGSize viewSize = self.view.frame.size; CGSize controllerSize = toViewController.view.frame.size; CGFloat controllerFromX = viewCenter.x – (controllerSize.width / 2); CGFloat controllerFromY = viewCenter.y – (controllerSize.height / 2); […]

UITableView:显示最后一个单元格的分隔符的正确方法

问题是什么是在表格/部分的最后一个单元格中显示分隔符的最右边的方法。 基本上这是我所追求的。 这是从原生的音乐应用程序,这使我认为应该可以通过UITableView实现,他们不会使用一些私人API的细胞分离器,对不对? 我知道你可以不用实际的分隔符,但在单元格的底部添加一条像素线。 但我不是这种方法的粉丝,因为 当一个单元格被选中/突出显示时, 其分隔符和 前一个单元格的分隔符会自动隐藏(请参阅第二个屏幕截图,选中“您必须疯了”)。 这是我想要UITableView来处理,而不是自己做,如果我使用一个像素线(这是特别方便的单元格分隔符不会一直延伸到表视图的边缘,分隔符和选定的单元格背景不看一起很好)。 我想尽可能保持单元格的滚动性能。 也有一些UITableView引用,让我觉得有一个简单的方法来得到我想要的: 在iOS 7和更高版本中,单元格分隔符不会一直延伸到表视图的边缘。 该属性为表格中的所有单元格设置默认的插入,就像rowHeight设置单元的默认高度。 它还用于pipe理在普通样式表底部绘制的“额外”分隔符。 有人知道如何使用在普通样式表底部绘制的这些“额外”分隔符吗? 因为这正是我所需要的。 我认为分配给UITableView separatorInset ,而不是UITableViewCell会做的伎俩,但它不,最后一个单元格仍然缺less其分隔符。 现在我只能看到一个选项:有一个自定义的页脚模仿最后一个单元格的分隔符。 这是不好的,特别是如果你想要使用tableView:titleForFooterInSection:方法有一个实际的部分页脚。

CGImageCreateWithMaskingColors不适用于iOS7

我在iOS5和iOS6上开发了一个应用程序。 升级到XCode 5和iOS7后,我有一些新的bug。 主要的一点就是colorMasking不再有效。 完全相同的代码仍然编译和iOS6的手机上工作。 在iOS7上,蒙版颜色仍然存在。 我试图在Google上find答案,但还没有find答案。 这是一个iOS7的错误,还是有人知道一个更好的方法做色罩? 这里是代码: – (UIImage*) processImage :(UIImage*) image { UIImage *inputImage = [UIImage imageWithData:UIImageJPEGRepresentation(image, 1.0)]; const float colorMasking[6]={100.0, 255.0, 0.0, 100.0, 100.0, 255.0}; CGImageRef imageRef = CGImageCreateWithMaskingColors(inputImage.CGImage, colorMasking); UIImage* finalImage = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef); return finalImage; } 这里有几个StackOverflow的post,我发现,帮助我在iOS6中工作的第一个地方: 透明度iOS的 iOS颜色透明的UIImage

禁用UITextviewselect文本和复制/粘贴菜单

我想禁用复制/粘贴菜单,我在UITextView中使用多个超链接,并希望只禁用菜单的HTML标记。 我的texview图像

UITextField在iOS 7的UISearchBar中

我正在尝试使用其中的TextField完成与UISearchBar相同的外观,就像在我的iOS 6应用程序中一样。 我试图用几种方法编码,但还没有成功。 问题是,自iOS 7以来,我无法以任何方式更改TextField的框架。结果是,我的TextField获取了NavigationBar中的所有空间,并覆盖了右侧的UIBarButtonItem(菜单button)。 见下图: 截图http://oi44.tinypic.com/2ufewx0.jpg iOS 6代码: 这是我在iOS 6中编写的代码,我可以将TextFields框架设置为我喜欢的任何内容。 UITextField *sbTextField = (UITextField *)[searchBar.subviews lastObject]; [sbTextField removeFromSuperview]; CGRect rect = searchBar.frame; rect.size.height = 32; rect.size.width = 210; sbTextField.frame = rect; [sbTextField setAutoresizingMask:UIViewAutoresizingFlexibleBottomMargin]; UIBarButtonItem *searchBarNavigationItem = [[UIBarButtonItem alloc] initWithCustomView:sbTextField]; [[self navigationItem] setLeftBarButtonItem:searchBarNavigationItem]; 以上代码在iOS 7中的结果: ![iOS 7 look] iOS 7代码: 与iOS 7不同的是,您需要使用子视图才能将UITextField添加到UISearchBar / UINavigationBar。 通过这样做,我还没有能够改变它的框架。 […]

UIViews结束在标签栏下方

在我的应用程序中,我使用自动布局将bottomLayoutGuide的标准量与标签alignment。 当应用程序第一次启动时,一切都按照我想要的方式布置,但是当我切换标签并返回标签已经消失在标签栏控制器下。 如果我旋转设备,横向视图正确显示,当我旋转回肖像视图恢复正常。 我似乎无法弄清楚是什么导致了这种行为。 谢谢你的帮助!

NSClassFromString()总是返回nil

下面的代码打印nil ,尽pipeListCell是一个有效的类。 var lCellClass : AnyClass! = NSClassFromString("ListCell"); println(lCellClass); 文档是说方法返回 由aClassName命名的类对象,或者如果当前没有加载该名称的类, 则为 nil 。 如果aClassName是nil ,则返回nil 。 我也尝试获取当前NSClassFromString() LOADED NSClassFromString() ,但仍然是nil 可能是什么问题? 更新:甚至试图做到这一点NSClassFromString("Array")我仍然得到nil