Tag: ios6

iOS Autolayout:在resize的父视图中发布UILabels

我有一个只包含UILabel的视图。 这个标签包含多行文本。 父级具有可变宽度,可以用平移手势resize。 我的问题是,当我这样做resize的UILabel不重新计算其高度,使所有的内容仍然可见,它只是把它切断。 我已经设法修复它一点点的黑客,但它运行速度非常缓慢: – (void)layoutSubviews { CGSize labelSize = [self.labelDescription sizeThatFits:CGSizeMake(self.frame.size.width, FLT_MAX)]; if (self.constraintHeight) { [self removeConstraint:self.constraintHeight]; } self.constraintHeight = [NSLayoutConstraint constraintWithItem:self.labelDescription attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:labelSize.height]; [self addConstraint:self.constraintHeight]; [super layoutSubviews]; } 这不应该与自动布局自动发生? 编辑 我的观点的结构是: UIScrollView —> UIView —> UILabel 这里是UIScrollView的约束: <NSLayoutConstraint:0x120c4860 H:|-(>=32)-[DescriptionView:0x85c81c0] (Names: '|':UIScrollView:0x85db650 )>, <NSLayoutConstraint:0x120c48a0 H:|-(32@900)-[DescriptionView:0x85c81c0] priority:900 (Names: '|':UIScrollView:0x85db650 )>, […]

如何以编程方式在iOS中重新启动iPhone应用程序

有任何想法吗? 我find这样的方式http://writeitstudios.com/david/?p=54 但可能是简单的事情

应用程序窗口预计在应用程序启动结束时有一个根视图控制器 – 即使所有已知问题都已修复

我有这个问题,但是我在这个论坛或者networking上找不到的信息似乎都能够帮助我。 似乎有两个地方可能会出现这个错误: main.m – 我的function如下所示: int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } UIApplicationMain的最后一个参数返回我的AppDelegate类的NSString值。 因此这工作正常。 2.AppDelegate.m – 设置根视图控制器的方式如下: [self.window addSubview:rootViewController]; 但是,在我的应用程序已经更新为: self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; 所以目前互联网上的信息都没有工作。 我的同事可以很好地在电脑上工作 – 这是一个给我发送应用程序源代码的人,所以所有的设置和代码应该完全一样。 我正试图在模拟器中启动它。 它是针对iOS 5构build的,但我试图在iOS 6.0模拟器上运行它。 我有最新的XCode(4.5.1)。 这有什么理由吗? 我该如何纠正? 非常感谢 汤姆

推特框架为ios6如何login通过设置从应用程序

对于iOS5,我们可以参考: 在iOS5中使用Twitter框架提示login提醒? 但是,对于iOS6不会有任何帮助,我尝试了以下的方式,但有1键盘外观问题是目前有谁可以帮助我这个: SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; tweetSheet.view.hidden=TRUE; [self presentViewController:tweetSheet animated:YES completion:^{ [tweetSheet.view endEditing:YES]; }];

如何检测用户代理iOS 6和所有次要版本?

可能重复: 什么是iOS 6用户代理string? 有任何想法做一个简单的正则expression式或东西? iPhone和iPad之间的区别也不错。 任何帮助build立一些正则expression式赞赏:) 编辑:用户代理string: 什么是iOS 6用户代理string? 这个问题不同于可能的重复,因为我想根据我已经知道的信息来构build一个正则expression式(可以在可能的重复中find)

使UICollectionView可缩放?

是否有任何方法使UICollectionView zoomable ,即当你捏,所有的细胞可以放大和缩小。 我可以在UIScrollView通过从delegate方法返回UIScrollView的唯一subview来实现这一点 – (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView 由于UICollectionView是一种UIScrollView ,有没有办法或解决这个问题呢? UICollectionView是否有一个包含所有单元格的直接子视图? 谢谢

用iOS 6 SDK和Xcode 4.5构buildarmv6架构(目标iOS 3.1.3)?

有没有机会使用iOS 6 SDK开发针对iOS 3.1.3的应用程序? 如果我用旧的部署目标打开我的项目,编译器会警告我: iOS deployment targets lower than 4.3 are not supported 这可能是由于显然只有armv7和armv7s二进制文件可以build立的事实。 如果我手动添加armv6 (在设备上工作,直到iPhone 3G),还有几个警告: warning: no rule to process file '$(PROJECT_DIR)/main.m' of type sourcecode.c.objc for architecture armv6 … … warning: architecture armv6 is not supported (current ARCHS = "armv6 armv7 armv7s"). 那我该如何处理呢? 有没有办法在使用iOS 6 SDK进行开发时支持iOS 3.1.3? 如果没有,我最终将不得不移动到iOS 4.3的最低目标。 是否可以提交仅支持版本> = 4.3的新版本? […]

捕获UIView并保存为图像

首先在UIImageView上添加UILable ,然后在截图UIView ,图像不正确的捕获UIView帧,我也附加图像的URL。 1)原始图片链接: – 2)捕获图像链接后: – 代码: – UIGraphicsBeginImageContext(viewImage.frame.size); [viewImage.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *vwImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData *data=UIImagePNGRepresentation(vwImage); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; // NSString *imgName = [NSString stringWithFormat:imagename]; NSString *strPath = [documentsDirectory stringByAppendingPathComponent:imagename]; [data writeToFile:strPath atomically:YES];

iOS 6的地址簿不起作用?

我从地址簿中以编程方式检索电子邮件地址的方法似乎不再适用于iOS 6设备。 它在iOS 5中工作,奇怪,仍然在iOS 6模拟器中工作。 有没有一种新的方式来从用户的地址簿中编程检索联系人? ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook); CFIndex nPeople = ABAddressBookGetPersonCount(addressBook); self.contacts = [[NSMutableArray alloc] init]; int contactIndex = 0; for (int i = 0; i < nPeople; i++) { // Get the next address book record. ABRecordRef record = CFArrayGetValueAtIndex(allPeople, i); // Get array of email addresses […]

更改UIImageView大小以使图像与AutoLayout匹配

我想改变我的UIImageView的高度/宽度,以匹配我从相册中select的图像,我在这里find了一个片段,这样做。 -(CGRect)frameForImage:(UIImage *)imgs inImageViewAspectFit:(UIImageView *)imagev { float imageRatio = imgs.size.width / imgs.size.height; float viewRatio = imagev.frame.size.width / imagev.frame.size.height; if(imageRatio < viewRatio) { float scale = imagev.frame.size.height / imgs.size.height; float width = scale * imgs.size.width; float topLeftX = (imagev.frame.size.width – width) * 0.5; NSLog(@"image after aspect fit: width=%f",width); imagev.frame = CGRectMake(topLeftX, 0, width, imagev.frame.size.height); return CGRectMake(topLeftX, […]