Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you create an NSValue wrapping a UIOffset struct?
    primarykey
    data
    text
    <p>I'm trying to change the text shadow position of my <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UISegmentedControl_Class/Reference/UISegmentedControl.html" rel="nofollow noreferrer">UISegmentedControl</a>. To do this, the <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/NSString_UIKit_Additions/Reference/Reference.html#//apple_ref/doc/uid/TP40006893" rel="nofollow noreferrer">documentation</a> says I need to pass in an <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsvalue_Class/Reference/Reference.html" rel="nofollow noreferrer">NSValue</a> which wraps a UIOffset struct.</p> <pre><code>UITextAttributeTextShadowOffset Key to the offset used for the text shadow in a text attributes dictionary. The corresponding value is an instance of NSValue wrapping a UIOffset struct. Available in iOS 5.0 and later. Declared in UIStringDrawing.h. </code></pre> <p>The problem is <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsvalue_Class/Reference/Reference.html" rel="nofollow noreferrer">NSValue</a> has no such wrapper method for a UIOffset struct - just search the documentation. I saw a lot of <a href="https://stackoverflow.com/questions/7810563/how-do-you-use-settitletextattributesforstate-in-uibaritem-in-ios-5-0">sample code</a> use this nonexistent function.</p> <pre><code>[NSValue valueWithUIOffset:UIOffsetMake(0, 1)] </code></pre> <p>It crashes when I try to run it. I don't understand how so many sample code can run it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload