Questions tagged [nsparagraphstyle]

49 questions
3
votes
1 answer

As of iOS 10.3: UIButton ignoring negative paragraph lineSpacing in NSAttributedString

I have a UIButton which is really just 2 words, wrapped to 2 lines (I set the lines value to "2" in code later). I have been tightening up the default lineSpacing by putting in a negative value for the paragraph lineSpacing (as simplified & shown…
eric
  • 391
  • 2
  • 13
3
votes
0 answers

NSParagraphStyle defaultParagraphStyle not having effect

Trying to set the paragraph styles for an NSTextView. Am I doing something wrong here, or putting the code in the wrong place perhaps..? I have this code in the subclass of my NSTextView. This does not affect my text view in any way: class…
Gary Simpson
  • 2,677
  • 2
  • 17
  • 18
3
votes
1 answer

boundingRectWithSize:options:context: calculate size not consider NSParagraphStyle.firstLineHeadIndent

for example: import Foundation import UIKit var str = NSString(string: "saldkjaskldjhf") var font = UIFont.systemFontOfSize(14.0) var attributes:[String:AnyObject] = [NSFontAttributeName: font] var attriStrWithoutParagraph =…
0oneo
  • 695
  • 7
  • 10
2
votes
1 answer

How to Set the Paragraph Property Width of NSTextView

My English is terrible, and I don't know how to describe it. Please look at the picture I uploaded first. This is a screenshot from Ulysses. This should be a NSTextView control. After selecting all the text, I found that it could control the…
Simon
  • 438
  • 4
  • 14
2
votes
4 answers

How to Increase Line spacing in UILabel in Swift 4

I want to increase the Line Spacing in UILabel but I can't figure it out how. I found this solution [https://stackoverflow.com/a/39158698/8633963] on Stackoverflow but my Xcode always displays this: Use of unresolved identifier…
Enes
  • 79
  • 1
  • 9
2
votes
1 answer

UILabel not working with NSAttributedString + NSParagraphStyle for Right-To-Left

I'm having problems with UILabels that use NSAttributedStrings with NSParagraphStyle when I use UISemanticContentAttributeForceRightToLeft. I have a demo app with just 2 labels on the UI. They have leading and trailing constraints. I'm making the…
miguel.gazela
  • 143
  • 2
  • 14
2
votes
3 answers

How to center image in attributed string?

I have an image that I want to center alongside a bunch of text but even when I set the NSMutableParagraphStyle alignment to center, the line with the image does not center If anyone could please help me center the line with the image (i.e. first…
14wml
  • 4,048
  • 11
  • 49
  • 97
2
votes
1 answer

paragraphSpacingBefore from NSParagraphStyle does not work

The paragraphSpacingBefore property of NSParagraphStyle does not seem to do anything. I'm pretty sure it worked in a previous project, but I don't see anything different in my old code that what I'm doing now. Here's my sample…
Casey Perkins
  • 1,853
  • 2
  • 23
  • 41
2
votes
1 answer

What difference between paragraphSpacing and paragraphSpacingBefore? (in NSMutableParagraphStyle)

https://developer.apple.com/library/ios/documentation/Cocoa/Reference/ApplicationKit/Classes/NSMutableParagraphStyle_Class/#//apple_ref/occ/instp/NSMutableParagraphStyle/paragraphSpacing I read already this post. But I can't understanding…
AKillUea
  • 145
  • 1
  • 1
  • 9
2
votes
2 answers

How can I add different line spacing for different parts of NSAttributedString?

I want to have a single NSAttributedString contain multiple messages. If a single message has a long text and it wraps around, I want to have a line spacing of, say, 5. Because I have a single NSAttributedString contain multiple messages, I want to…
SirRupertIII
  • 12,324
  • 20
  • 72
  • 121
2
votes
1 answer

NSTextAlignmentCenter and NSTextAlignmentRight are the wrong way round in NSTextTab?

Can anyone please check something for me... Just to make sure I'm not going mad! I created an NSMutableParagraphStyle with tabStops, but they weren't appearing where I was expecting: float width =…
jowie
  • 8,028
  • 8
  • 55
  • 94
1
vote
1 answer

UITextView add new line but not new paragrafh

in a UItextView I am using paragraphStyle to space the new paragraphs between them. let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.paragraphSpacing = 20 However, I would need to insert a new line without it being a new…
Stefano Vet
  • 567
  • 1
  • 7
  • 18
1
vote
1 answer

NSAttributedString: how to make multiline in another NSAttributedString

I am trying to create a multiline separate text in another text to achieve the below text style. I have tried the below code to produce the goal but the third part of the code is creating a issue (with medium font) private func…
1
vote
0 answers

Indent specific individual paragraphs of a UITextView

I'm building up the textual content of a UITextView, by adding individual paragraphs one at a time to an NSMutableAttributedString. Some of these paragraphs need to be indented, as they are hierarchical, as in: 1. ... (a). ... (i).…
1
vote
1 answer

Maximum lineheight cutting off text

[ I'm looking to make a pixelPerfect UI. My designer gave me a few requirements for a specific font. I'm trying to implement them but I've run into some issues with paragraphStyle. All text first baselines must be positioned on a grid. When setting…
Arne Oldenhave
  • 201
  • 1
  • 3
  • 12