Difference between revisions of "UIButton"

From iPhone Development Wiki
Jump to: navigation, search
m (Button types: 2 more button types.)
Line 1: Line 1:
'''UIButton''' is a UI element, which is usually a button that the user can tap on to do some actions.
+
The NSAutoreleasePool class is a thin wrapper around the '''NSPushAutoreleasePool''' and '''NSPopAutoreleasePool''' functions.
  
== Button types ==
+
<source lang="objc">
{{function signature
+
#ifdef __cplusplus
|signature=+(UIButton*)buttonWithType:(UIButtonType)type;
+
extern "C" {
|firmware=2.0 –
+
#endif
}}
+
void *NSPushAutoreleasePool(NSUInteger capacity);
There 6 documented button types and 9 undocumented button types
+
void NSPopAutoreleasePool(void* token);
{| class="wikitable"
+
#ifdef __cplusplus
|-
+
}
! Type !! Class !! Note
+
#endif
|-
+
</source>
| 0 (UIButtonTypeCustom) || UIButton ||
 
|-
 
| 1 (UIButtonTypeRoundedRect) || UIRoundedRectButton ||
 
|-
 
| 2 (UIButtonTypeDetailDisclosure) || UIButton || UITableNextButton.png / UITableNextButtonPressed.png
 
|-
 
| 3 (UIButtonTypeInfoLight) || UIButton || UIButtonBarInfo.png
 
|-
 
| 4 (UIButtonTypeInfoDark) || UIButton || UIButtonBarInfoDark.png
 
|-
 
| 5 (UIButtonTypeContactAdd) || UIButton || UIButtonBarContactAdd.png / UIButtonBarContactAddPressed.png
 
|-
 
| 100 || [[UINavigationButton]] || style = 0
 
|-
 
| 101 || UINavigationButton || style = 1
 
|-
 
| 102 || UINavigationButton || style = 2
 
|-
 
| 110 || [[UITexturedButton]] ||
 
|-
 
| 111 || [[UIGlassButton]] ||
 
|-
 
| 112 || UINavigationButton || style = 4
 
|-
 
| 113 || UIRoundedRectButton || fillColor = [[UIColor|tableCellGroupedBackgroundColor]]
 
|-
 
| 114 || [[UIPopoverButton]] || Normal
 
|-
 
| 115 || UIPopoverButton || Delete
 
|}
 
  
== References ==
+
Example:
* Official documentation: {{sdklink|UIKit|UIButton}}
+
 
{{IPFHeader|UIKit|3=2}}
+
<source lang="objc">
 +
static void MyMethod()
 +
{
 +
    void *pool = NSPushAutoreleasePool(0);
 +
    [[[NSObject alloc] init] autorelease];
 +
    NSPopAutoreleasePool(pool);
 +
}
 +
</source>
 +
 
 +
The "capacity" argument of NSPushAutoreleasePool only serves as a hint. It is unused in the current implementation.
 +
 
 +
{{occlass|library=Foundation.framework}}

Revision as of 09:44, 2 February 2017

The NSAutoreleasePool class is a thin wrapper around the NSPushAutoreleasePool and NSPopAutoreleasePool functions.

#ifdef __cplusplus
extern "C" {
#endif
void *NSPushAutoreleasePool(NSUInteger capacity);
void NSPopAutoreleasePool(void* token);
#ifdef __cplusplus
}
#endif

Example:

static void MyMethod()
{
    void *pool = NSPushAutoreleasePool(0);
    [[[NSObject alloc] init] autorelease];
    NSPopAutoreleasePool(pool);
}

The "capacity" argument of NSPushAutoreleasePool only serves as a hint. It is unused in the current implementation.