equal
deleted
inserted
replaced
30 |
30 |
31 -(void) didReceiveMemoryWarning { |
31 -(void) didReceiveMemoryWarning { |
32 // Releases the view if it doesn't have a superview. |
32 // Releases the view if it doesn't have a superview. |
33 [super didReceiveMemoryWarning]; |
33 [super didReceiveMemoryWarning]; |
34 // Release any cached data, images, etc that aren't in use. |
34 // Release any cached data, images, etc that aren't in use. |
|
35 if (popupMenu.view.superview == nil) |
|
36 popupMenu = nil; |
35 } |
37 } |
36 |
38 |
37 -(void) didRotate:(NSNotification *)notification { |
39 -(void) didRotate:(NSNotification *)notification { |
38 UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; |
40 UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; |
39 CGRect rect = [[UIScreen mainScreen] bounds]; |
41 CGRect rect = [[UIScreen mainScreen] bounds]; |
146 -(void) viewDidUnload { |
148 -(void) viewDidUnload { |
147 self.writeChatTextField = nil; |
149 self.writeChatTextField = nil; |
148 self.popoverController = nil; |
150 self.popoverController = nil; |
149 self.popupMenu = nil; |
151 self.popupMenu = nil; |
150 [super viewDidUnload]; |
152 [super viewDidUnload]; |
|
153 MSG_DIDUNLOAD(); |
151 } |
154 } |
152 |
155 |
153 -(void) dealloc { |
156 -(void) dealloc { |
154 [dimTimer invalidate]; |
157 [dimTimer invalidate]; |
155 [writeChatTextField release]; |
158 [writeChatTextField release]; |
234 -(IBAction) showPopover{ |
237 -(IBAction) showPopover{ |
235 isPopoverVisible = YES; |
238 isPopoverVisible = YES; |
236 CGRect anchorForPopover; |
239 CGRect anchorForPopover; |
237 Class popoverControllerClass = NSClassFromString(@"UIPopoverController"); |
240 Class popoverControllerClass = NSClassFromString(@"UIPopoverController"); |
238 if (popoverControllerClass) { |
241 if (popoverControllerClass) { |
239 #ifdef __IPHONE_3_2 |
242 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2 |
240 popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStylePlain]; |
243 if (popupMenu == nil) |
|
244 popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStylePlain]; |
241 popoverController = [[popoverControllerClass alloc] initWithContentViewController:popupMenu]; |
245 popoverController = [[popoverControllerClass alloc] initWithContentViewController:popupMenu]; |
242 [popoverController setPopoverContentSize:CGSizeMake(220, 170) animated:YES]; |
246 [popoverController setPopoverContentSize:CGSizeMake(220, 170) animated:YES]; |
243 [popoverController setPassthroughViews:[NSArray arrayWithObject:self.view]]; |
247 [popoverController setPassthroughViews:[NSArray arrayWithObject:self.view]]; |
244 |
248 |
245 if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) |
249 if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) |
251 inView:self.view |
255 inView:self.view |
252 permittedArrowDirections:UIPopoverArrowDirectionUp |
256 permittedArrowDirections:UIPopoverArrowDirectionUp |
253 animated:YES]; |
257 animated:YES]; |
254 #endif |
258 #endif |
255 } else { |
259 } else { |
256 popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
260 if (popupMenu == nil) |
|
261 popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
257 popupMenu.view.backgroundColor = [UIColor clearColor]; |
262 popupMenu.view.backgroundColor = [UIColor clearColor]; |
258 popupMenu.view.frame = CGRectMake(480, 0, 200, 170); |
263 popupMenu.view.frame = CGRectMake(480, 0, 200, 170); |
259 [self.view addSubview:popupMenu.view]; |
264 [self.view addSubview:popupMenu.view]; |
260 |
265 |
261 [UIView beginAnimations:@"showing popover" context:NULL]; |
266 [UIView beginAnimations:@"showing popover" context:NULL]; |
270 -(void) dismissPopover { |
275 -(void) dismissPopover { |
271 if (YES == isPopoverVisible) { |
276 if (YES == isPopoverVisible) { |
272 isPopoverVisible = NO; |
277 isPopoverVisible = NO; |
273 |
278 |
274 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
279 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
275 #ifdef __IPHONE_3_2 |
280 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2 |
276 [popoverController dismissPopoverAnimated:YES]; |
281 [popoverController dismissPopoverAnimated:YES]; |
277 #endif |
282 #endif |
278 } else { |
283 } else { |
279 [UIView beginAnimations:@"hiding popover" context:NULL]; |
284 [UIView beginAnimations:@"hiding popover" context:NULL]; |
280 [UIView setAnimationDuration:0.35]; |
285 [UIView setAnimationDuration:0.35]; |