Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adds toggle to switch4 that hides and shows switch1 to test for memor…

…y leak.
  • Loading branch information...
commit f4f9ea4fda9e4a8654ca3ca520f0c7f9d10f617d 1 parent 9a58af3
@LordLobo authored
View
2  LLRoundSwitch/LLRoundSwitchKnobLayer.m
@@ -33,7 +33,7 @@ - (void)drawInContext:(CGContextRef)context
CGContextClip(context);
CGColorRef knobStartColor = [UIColor colorWithWhite:0.82 alpha:1.0].CGColor;
CGColorRef knobEndColor = (self.gripped) ? [UIColor colorWithWhite:0.894 alpha:1.0].CGColor : [UIColor colorWithWhite:0.996 alpha:1.0].CGColor;
- CGPoint topPoint = CGPointMake(0, 0);
+ CGPoint topPoint = CGPointMake(0, 0);
CGPoint bottomPoint = CGPointMake(0, knobRadius + 2);
CGGradientRef knobGradient = GradientCreateWithColors(colorSpace, knobStartColor, knobEndColor);
CGContextDrawLinearGradient(context, knobGradient, topPoint, bottomPoint, 0);
View
1  LLRoundSwitchDemo/LLRoundSwitchDemo/LLRoundSwitchDemoViewController.h
@@ -16,6 +16,7 @@
@property (strong, nonatomic) IBOutlet LLRoundSwitch *switch1;
@property (strong, nonatomic) IBOutlet LLRoundSwitch *switch2;
@property (strong, nonatomic) IBOutlet LLRoundSwitch *switch3;
+@property (strong, nonatomic) IBOutlet LLRoundSwitch *switch4;
@property (strong, nonatomic) IBOutlet LLRoundSwitch *longSwitch;
@property (strong, nonatomic) IBOutlet LLRoundSwitch *fatSwtich;
View
11 LLRoundSwitchDemo/LLRoundSwitchDemo/LLRoundSwitchDemoViewController.m
@@ -10,7 +10,7 @@
@implementation LLRoundSwitchDemoViewController
-@synthesize switch1, switch2, switch3;
+@synthesize switch1, switch2, switch3, switch4;
@synthesize fatSwtich, longSwitch;
- (void)didReceiveMemoryWarning
@@ -41,6 +41,9 @@ - (void)viewDidLoad
// and give switch3 an event too
[switch3 addTarget:self action:@selector(switch3Toggled:) forControlEvents:UIControlEventValueChanged];
+ // switch4 event - toggle switch1 visibility
+ [switch4 addTarget:self action:@selector(switch4Toggled:) forControlEvents:UIControlEventValueChanged];
+
// fatswitch doesn't have time for words
fatSwtich.OnText = @"1";
fatSwtich.offText = @"0";
@@ -61,6 +64,12 @@ - (void)switch3Toggled:(id)sender
[fatSwtich setOn:!fatSwtich.isOn animated:YES];
}
+- (void)switch4Toggled:(id)sender
+{
+ // toggle switch1 visibilty to try to get re-renders to induce a leak
+ [switch1 setHidden:!switch1.hidden];
+}
+
- (void)viewDidUnload
{
[super viewDidUnload];
View
16 LLRoundSwitchDemo/LLRoundSwitchDemo/en.lproj/LLRoundSwitchDemoView.xib
@@ -139,7 +139,6 @@
<string key="NSFrame">{{20, 340}, {280, 33}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:196</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
@@ -246,6 +245,14 @@
</object>
<int key="connectionID">23</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">switch4</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191548217"/>
+ </object>
+ <int key="connectionID">24</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -357,7 +364,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">23</int>
+ <int key="maxID">24</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -378,6 +385,7 @@
<string key="switch1">LLRoundSwitch</string>
<string key="switch2">LLRoundSwitch</string>
<string key="switch3">LLRoundSwitch</string>
+ <string key="switch4">LLRoundSwitch</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="fatSwtich">
@@ -400,6 +408,10 @@
<string key="name">switch3</string>
<string key="candidateClassName">LLRoundSwitch</string>
</object>
+ <object class="IBToOneOutletInfo" key="switch4">
+ <string key="name">switch4</string>
+ <string key="candidateClassName">LLRoundSwitch</string>
+ </object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
Please sign in to comment.
Something went wrong with that request. Please try again.