Monday, June 10, 2013
Tuesday, April 2, 2013
[Bug in sample Code] On iOS 6 and Later, a View Controller Unloads Its Own Views When Desired
Documet Link
On iOS 6 and Later, a View Controller Unloads Its Own Views When Desired
Listing 4-3 Releasing the views of a view controller not visible on screen
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Add code to clean up any of your own resources that are no longer necessary.
if ([self.view window] == nil)
{
// Add code to preserve data stored in the views that might be
// needed later.
// Add code to clean up other strong references to the view in
// the view hierarchy.
self.view = nil;
}
}
The Condition should be [self isViewLoaded] && [self.view window] == nil
Monday, April 1, 2013
[Bug in sample Code] On iOS 6 and Later, a View Controller Unloads Its Own Views When Desired
Documet Link
On iOS 6 and Later, a View Controller Unloads Its Own Views When Desired
Listing 4-3 Releasing the views of a view controller not visible on screen
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Add code to clean up any of your own resources that are no longer necessary.
if ([self.view window] == nil)
{
// Add code to preserve data stored in the views that might be
// needed later.
// Add code to clean up other strong references to the view in
// the view hierarchy.
self.view = nil;
}
}
The Condition should be [self isViewLoaded] && [self.view window] == nil
Saturday, March 9, 2013
Re: Getting error when trying to programmatically switch views?
Make sure, you mapped your viewController object to the correct InterfaceBuilder item. The "flightdataview" not allocated.
Friday, March 8, 2013
Getting error when trying to programmatically switch views?
I declared my view in my .h with:
IBOutlet UIViewController *flightdataview;
@property (nonatomic,retain) IBOutlet UIViewController *flightdataview;
and I'm trying to switch views using this code:
[self presentModalViewController:flightdataview animated:YES];
However I get this when I try to switch views:
'Application tried to present a nil modal view controller on target
Any ideas?
Thanks.
Thursday, January 17, 2013
Overlapping views and touch event regions are inconsistent
I have placed 2 views (table views) within a view container that are partially overlapped, on purpose. View A overlaps about 50% of View B.
If I move View B so they no longer overlap:
The screenshot on the left shows the 2 views after the move. The screen on the right shows a blue region which represents where the original view was and where the touch events for viewB are.
The previously overlapped region within View A does not respond to touch events, that is, ~50% does not, i.e. the overlapped portion you see in the above screen shot.. Only the region that wasn't orginally overlapped does. In addition, within View B, the portion that is now occupying new space within the superview, does not respond to touch events, only the portion of the view that happens to occupy the old region.
The code is simple that I'm using to move the view:
UIView* viewA = [self.childViewControllers[0] view];
UIView* viewB = [self.childViewControllers.lastObject view];
CGRect rect = main.frame;
rect.origin.x += viewB.frame.size.width;
[UIView animateWithDuration:0.2 animations:^{
viewB.frame = rect;
}];
Visually, the view moves but the touch region doesn't.
I used the new storyboard "Container View" mechanism within iOS 6 to initially place the views.
I have no idea why this is happening. Any ideas?
Thanks.
Thursday, January 10, 2013
Overlapping views and touch event regions are inconsistent
I have placed 2 views (table views) within a view container that are partially overlapped, on purpose. View A overlaps about 50% of View B.
If I move View B so they no longer overlap:
The screenshot on the left shows the 2 views after the move. The screen on the right shows a blue region which represents where the original view was and where the touch events for viewB are.
The previously overlapped region within View A does not respond to touch events, that is, ~50% does not, i.e. the overlapped portion you see in the above screen shot.. Only the region that wasn't orginally overlapped does. In addition, within View B, the portion that is now occupying new space within the superview, does not respond to touch events, only the portion of the view that happens to occupy the old region.
The code is simple that I'm using to move the view:
UIView* viewA = [self.childViewControllers[0] view];
UIView* viewB = [self.childViewControllers.lastObject view];
CGRect rect = main.frame;
rect.origin.x += viewB.frame.size.width;
[UIView animateWithDuration:0.2 animations:^{
viewB.frame = rect;
}];
Visually, the view moves but the touch region doesn't.
I used the new storyboard "Container View" mechanism within iOS 6 to initially place the views.
I have no idea why this is happening. Any ideas?
Thanks.