Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rethish

macrumors member
Original poster
Oct 16, 2008
41
0
hi all,

I would like to use bullets and numberings in the textview .
I found some of search results for this topic ,they were about NSTextList .
How can it be used.

please provide me some help on NSTextList.


thank you
 

rethish

macrumors member
Original poster
Oct 16, 2008
41
0
hai,


I had referred the documentation. I managed to understand a little concepts by referring some examples from websites. Now the task is partially done .

But the problem now is , this bullets and numberings works only if there is no contents(text) in the textview.

i want to use bullets and numberings to text that is already been typed , likewise in textedit



the code is :

if([[popupbutton titleOfSelectedItem] isEqualToString:mad:"-" ])
{
NSTextStorage *storage=[textview textStorage];


[storage beginEditing];
NSMutableAttributedString *text = [[NSMutableAttributedString
alloc]initWithAttributedString:storage];


NSMutableParagraphStyle *mps = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
NSTextList *listItem = [[NSTextList alloc] initWithMarkerFormat:mad:"{hyphen}" options:NSTextListPrependEnclosingMarker];
[mps setTextLists:[NSArray arrayWithObject:listItem]];
NSMutableString *tabs = [@"\t" mutableCopy];

[tabs appendString:mad:"\t"];

[text appendAttributedString: [[NSAttributedString alloc]
initWithString:[NSString stringWithFormat:mad:"\t%@\t", [listItem markerForItemNumber:1] ]
attributes:[NSDictionary dictionaryWithObject:mps
forKey:NSParagraphStyleAttributeName]]];
[storage setAttributedString:text];
[storage endEditing];


}







please provide me some tips to overcome this problem

thankyou.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.