• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Centering an NSAttributedString in a line in a view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Centering an NSAttributedString in a line in a view


  • Subject: Re: Centering an NSAttributedString in a line in a view
  • From: email@hidden
  • Date: Wed, 19 Jul 2006 11:14:26 +0200 (CEST)
  • Importance: Normal

>Could you please actually *show* your -pageFooter: code?
>
>m.

   Of course. I did not put it in my first post to keep it short. Here it
is :

-(NSAttributedString*) pageFooter
{
     NSAttributedString* oldFooter;
     NSMutableAttributedString* newFooter;
     unsigned footerLength;
     NSRange range;
     NSDictionary* attributes;
     NSMutableParagraphStyle* parsty;

     oldFooter=[super pageFooter];
	 footerLength=[oldFooter length];
	 range.location=0;
	 range.length=footerLength;
	 attributes=[oldFooter
	                            attributesAtIndex: 0
							longestEffectiveRange: NULL
							              inRange: range];
	 parsty=[attributes objectForKey : NSParagraphStyleAttributeName];
	 [parsty setAlignment: NSCenterTextAlignment];
	 newFooter=
                [[NSMutableAttributedString alloc]
                   initWithAttributedString: oldFooter];
	 [newFooter
                  addAttribute: NSParagraphStyleAttributeName
                         value: parsty
                         range: range];
	 return newFooter;
}

                                                                                                  Ewan


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Centering an NSAttributedString in a line in a view (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: cross development problem
  • Next by Date: Re: Prepending to fixed length
  • Previous by thread: Re: Centering an NSAttributedString in a line in a view
  • Next by thread: Re: Centering an NSAttributedString in a line in a view
  • Index(es):
    • Date
    • Thread