[iPhone] Fixed minor 3.1 compatibility issues

This commit is contained in:
Alex Zolotarev 2011-02-28 13:06:41 +01:00 committed by Alex Zolotarev
parent 09e15c9f1a
commit adda3c0f39
3 changed files with 26 additions and 8 deletions

View file

@ -151,8 +151,13 @@
- (void)layoutSubviews
{
NSLog(@"layoutSubviews");
[[self controller] onResize:self.frame.size.width * self.contentScaleFactor withHeight:self.frame.size.height * self.contentScaleFactor];
[self onSize:self.frame.size.width * self.contentScaleFactor withHeight:self.frame.size.height * self.contentScaleFactor];
CGFloat scaleFactor = 1.0;
if ([self respondsToSelector:@selector(contentScaleFactor)])
scaleFactor = self.contentScaleFactor;
[[self controller] onResize:self.frame.size.width * scaleFactor withHeight:self.frame.size.height * scaleFactor];
[self onSize:self.frame.size.width * scaleFactor withHeight:self.frame.size.height * scaleFactor];
[self drawView];
}

View file

@ -123,10 +123,14 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
NSSet * allTouches = [event allTouches];
int touchCount = [allTouches count];
CGFloat scaleFactor = 1.0;
if ([self.view respondsToSelector:@selector(contentScaleFactor)])
scaleFactor = self.view.contentScaleFactor;
if (touchCount == 1)
{
CGPoint pt = [[[allTouches allObjects] objectAtIndex:0] locationInView:nil];
m_Pt1 = m2::PointD(pt.x * self.view.contentScaleFactor, pt.y * self.view.contentScaleFactor);
m_Pt1 = m2::PointD(pt.x * scaleFactor, pt.y * scaleFactor);
}
else
{
@ -134,8 +138,8 @@ NSInteger compareAddress(UITouch * l, UITouch * r, void * context)
CGPoint pt1 = [[sortedTouches objectAtIndex:0] locationInView:nil];
CGPoint pt2 = [[sortedTouches objectAtIndex:1] locationInView:nil];
m_Pt1 = m2::PointD(pt1.x * self.view.contentScaleFactor, pt1.y * self.view.contentScaleFactor);
m_Pt2 = m2::PointD(pt2.x * self.view.contentScaleFactor, pt2.y * self.view.contentScaleFactor);
m_Pt1 = m2::PointD(pt1.x * scaleFactor, pt1.y * scaleFactor);
m_Pt2 = m2::PointD(pt2.x * scaleFactor, pt2.y * scaleFactor);
}
}

View file

@ -276,7 +276,10 @@ TIndex g_clickedIndex;
cancelButtonTitle: @"Cancel"
destructiveButtonTitle: @"Delete"
otherButtonTitles: nil];
[popupQuery showFromRect: [cell frame] inView: tableView animated: YES];
if([popupQuery respondsToSelector:@selector(showFromRect)])
[popupQuery showFromRect: [cell frame] inView: tableView animated: YES];
else
[popupQuery showInView: tableView];
[popupQuery release];
}
break;
@ -321,7 +324,10 @@ TIndex g_clickedIndex;
cancelButtonTitle: @"Cancel"
destructiveButtonTitle: nil
otherButtonTitles: strDownload, nil];
[popupQuery showFromRect: [cell frame] inView: tableView animated: YES];
if([popupQuery respondsToSelector:@selector(showFromRect)])
[popupQuery showFromRect: [cell frame] inView: tableView animated: YES];
else
[popupQuery showInView: tableView];
[popupQuery release];
}
break;
@ -333,7 +339,10 @@ TIndex g_clickedIndex;
cancelButtonTitle: @"Do Nothing"
destructiveButtonTitle: @"Cancel Download"
otherButtonTitles: nil];
[popupQuery showFromRect: [cell frame] inView: tableView animated: YES];
if([popupQuery respondsToSelector:@selector(showFromRect)])
[popupQuery showFromRect: [cell frame] inView: tableView animated: YES];
else
[popupQuery showInView: tableView];
[popupQuery release];
}
break;