Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[AppStore] Deprecate screenX and screenY due to app store rejections.

Please use the new safeScreenX and safeScreenY.
  • Loading branch information...
commit 46e07bc437e1cb2eb7718bf4153ad7673c63e004 1 parent abb5506
@jverkoey jverkoey authored
View
2  src/TTPickerTextField.m
@@ -264,7 +264,7 @@ - (void)showSearchResults:(BOOL)show {
- (CGRect)rectForSearchResults:(BOOL)withKeyboard {
UIView* superview = self.superviewForSearchResults;
- CGFloat y = superview.screenY;
+ CGFloat y = superview.safeScreenY;
CGFloat visibleHeight = [self heightWithLines:1];
CGFloat keyboardHeight = withKeyboard ? TTKeyboardHeight() : 0;
CGFloat tableHeight = TTScreenBounds().size.height - (y + visibleHeight + keyboardHeight);
View
2  src/TTSearchTextField.m
@@ -486,7 +486,7 @@ - (CGRect)rectForSearchResults:(BOOL)withKeyboard {
CGFloat height = self.height;
CGFloat keyboardHeight = withKeyboard ? TTKeyboardHeight() : 0;
- CGFloat tableHeight = self.window.height - (self.screenY + height + keyboardHeight);
+ CGFloat tableHeight = self.window.height - (self.safeScreenY + height + keyboardHeight);
return CGRectMake(0, y + self.height-1, superview.frame.size.width, tableHeight+1);
}
View
24 src/Three20/UIViewAdditions.h
@@ -17,6 +17,8 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
+#import "Three20/TTGlobalCore.h"
+
@interface UIView (TTCategory)
/**
@@ -78,12 +80,30 @@
/**
* Return the x coordinate on the screen.
*/
-@property(nonatomic,readonly) CGFloat screenX;
+@property(nonatomic,readonly) CGFloat safeScreenX;
/**
* Return the y coordinate on the screen.
*/
-@property(nonatomic,readonly) CGFloat screenY;
+@property(nonatomic,readonly) CGFloat safeScreenY;
+
+#ifdef DEBUG
+
+/**
+ * Return the x coordinate on the screen.
+ *
+ * This method is being rejected by Apple due to false-positive private api static analysis.
+ */
+@property(nonatomic,readonly) CGFloat screenX __TTDEPRECATED_METHOD;
+
+/**
+ * Return the y coordinate on the screen.
+ *
+ * This method is being rejected by Apple due to false-positive private api static analysis.
+ */
+@property(nonatomic,readonly) CGFloat screenY __TTDEPRECATED_METHOD;
+
+#endif
/**
* Return the x coordinate on the screen, taking into account scroll views.
View
18 src/UIViewAdditions.m
@@ -195,7 +195,7 @@ - (void)setHeight:(CGFloat)height {
self.frame = frame;
}
-- (CGFloat)screenX {
+- (CGFloat)safeScreenX {
CGFloat x = 0;
for (UIView* view = self; view; view = view.superview) {
x += view.left;
@@ -203,7 +203,7 @@ - (CGFloat)screenX {
return x;
}
-- (CGFloat)screenY {
+- (CGFloat)safeScreenY {
CGFloat y = 0;
for (UIView* view = self; view; view = view.superview) {
y += view.top;
@@ -211,6 +211,18 @@ - (CGFloat)screenY {
return y;
}
+#ifdef DEBUG
+
+- (CGFloat)screenX {
+ return [self safeScreenX];
+}
+
+- (CGFloat)screenY {
+ return [self safeScreenY];
+}
+
+#endif
+
- (CGFloat)screenViewX {
CGFloat x = 0;
for (UIView* view = self; view; view = view.superview) {
@@ -330,7 +342,7 @@ - (CGRect)frameWithKeyboardSubtracted:(CGFloat)plusHeight {
if (TTIsKeyboardVisible()) {
CGRect screenFrame = TTScreenBounds();
CGFloat keyboardTop = (screenFrame.size.height - (TTKeyboardHeight() + plusHeight));
- CGFloat screenBottom = self.screenY + frame.size.height;
+ CGFloat screenBottom = self.safeScreenY + frame.size.height;
CGFloat diff = screenBottom - keyboardTop;
if (diff > 0) {
frame.size.height -= diff;
Please sign in to comment.
Something went wrong with that request. Please try again.