Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS支持可扩展字符串吗?_Ios_Objective C - Fatal编程技术网

iOS支持可扩展字符串吗?

iOS支持可扩展字符串吗?,ios,objective-c,Ios,Objective C,iOS中是否支持可扩展字符串? 我想创建一个下划线窗格,单击它,然后打开其他一些视图控制器。是的,它们在iOS中称为NSAttributedString 添加下划线的示例代码 NSString *str = @"Amit"; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str]; [attributedString addAttribute:NSU

iOS中是否支持可扩展字符串?

我想创建一个下划线窗格,单击它,然后打开其他一些视图控制器。

是的,它们在iOS中称为NSAttributedString

添加下划线的示例代码

NSString *str = @"Amit";
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];

[attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0, 4)];
更多信息@

要向该下划线添加链接,请签出以下代码:

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"Google Webpage"];
[attributedString addAttribute:NSLinkAttributeName
                         value:@"http://www.google.com"
                         range:[[attributedString string] rangeOfString:@"Google Webpage"]];


NSDictionary *linkAttributes = @{NSForegroundColorAttributeName: [UIColor greenColor],
                                 NSUnderlineColorAttributeName: [UIColor lightGrayColor],
                                 NSUnderlineStyleAttributeName: @(NSUnderlinePatternSolid)};

// assume that textView is a UITextView previously created (either by code or Interface Builder)
textView.linkTextAttributes = linkAttributes; // customizes the appearance of links
textView.attributedText = attributedString;
textView.delegate = self;

找到此源代码@

是的,它们在iOS中称为NSAttributedString

添加下划线的示例代码

NSString *str = @"Amit";
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];

[attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0, 4)];
更多信息@

要向该下划线添加链接,请签出以下代码:

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"Google Webpage"];
[attributedString addAttribute:NSLinkAttributeName
                         value:@"http://www.google.com"
                         range:[[attributedString string] rangeOfString:@"Google Webpage"]];


NSDictionary *linkAttributes = @{NSForegroundColorAttributeName: [UIColor greenColor],
                                 NSUnderlineColorAttributeName: [UIColor lightGrayColor],
                                 NSUnderlineStyleAttributeName: @(NSUnderlinePatternSolid)};

// assume that textView is a UITextView previously created (either by code or Interface Builder)
textView.linkTextAttributes = linkAttributes; // customizes the appearance of links
textView.attributedText = attributedString;
textView.delegate = self;
已找到此源代码@