* WARNING: This depends on undocumented APIs and may be fragile. For testing only.
*/
"
@implementation UITouch (TTCategory)- (id)initInView:(UIView *)view location:(CGPoint)location {if (self = [super init]) {_tapCount = 1; <= BAD_locationInWindow = location; <= BAD_previousLocationInWindow = location; <= BADUIView *target = [view.window hitTest:_locationInWindow withEvent:nil];_view = [target retain]; <= BAD_window = [view.window retain]; <= BAD_phase = UITouchPhaseBegan; <= BAD_touchFlags._firstTouchForView = 1; <= BAD_touchFlags._isTap = 1; <= BAD_timestamp = [NSDate timeIntervalSinceReferenceDate]; <= BAD}return self;}- (void)changeToPhase:(UITouchPhase)phase {_phase = phase; <= BAD_timestamp = [NSDate timeIntervalSinceReferenceDate]; <= BAD}@end
1. Delete the TTIsKeyboardVisible function in TTGlobal.h/m. Nothing
calls it.
2. Delete TTMessageController. It accounts for the majority of the
calls and MFMailComposeViewController in MessageUI basically makes it
obsolete.
3. Replace scrollFirstResponderIntoView in UITableViewAdditions with
this (or something similar):
-(void) scrollFirstResponderIntoView {
NSIndexPath *selectedRowIndexPath = [self indexPathForSelectedRow];
if (![[self indexPathsForVisibleRows]
containsObject:selectedRowIndexPath]) {
[self
scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionMiddle
animated:YES];
}
}
This breaks the TTTableControlItem... but they are kind broken in the
present form anyway so just add UITextFields directly to a
TTTableViewItem or don't use TTableItem/TTTableViewController for
views that need interaction. I would guesstimate that anything that
wants to scroll to TTStyledNode might be affected as well but can not
fathom where they might be used realistically other than a
TTStyledTextTableItemCell that might want to scroll to a particular
TTStyledNode subclass instance in its TTStyledTextLabel.
4. In frameWithKeyboardSubtracted in UIViewAdditions.m, Comment out
the line below (302 in e8ecb80) and the matching bracket:
if ([self.window performSelector:@selector(firstResponder)]) {
I removed these and the UITouch code from my own branch as soon as I
saw them, ages ago it seems now. I maintain my own branch manually,
incorporating changes by hand so that I am always aware of what is
going on inside the code. I did test them with the latest master,
e8ecb80, using TTCatalog. I found nothing that seemed broken aside
from scrolling for TTTableControlItem instances. There are prolly some
other issues... make the changes and report them back here. This is
what open source libraries are all about...
Apple needs to add an open source libraries and frameworks category to
the design awards at WWDC next year and Joe should win on iPhone OS
for Three20. That having been said, Three20 encompasses a number of
advanced concepts and anyone contemplating using it for production
applications, your own or for your clients or company, should take the
time to fully understand it.
Cheers,
David
That having been said, Three20 encompasses a number of
advanced concepts and anyone contemplating using it for production
applications, your own or for your clients or company, should take the
time to fully understand it.
//
// UIWindow+ttFirstResponder.h
// Three20
//
// Created by jonathan on 10/29/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIWindow (ttFirstResponder)
-(UIView *)ttFirstResponder;
@end
// UIWindow+ttFirstResponder.m
#import "UIWindow+ttFirstResponder.h"
UIView * recursiveFirstResponderSearchInView(UIView *viewToSearch)
{
UIView *fResponder = nil;
if([viewToSearch isFirstResponder])
{
return viewToSearch;
}
for (UIView *view in [viewToSearch subviews]) {
if([view isFirstResponder])
{
fResponder = view;
break;
}
UIView *someOtherView = recursiveFirstResponderSearchInView(view);
if([someOtherView isFirstResponder])
{
fResponder = someOtherView;
break;
}
}
return fResponder;
}
@implementation UIWindow (ttFirstResponder)
-(UIView *)ttFirstResponder;
{
UIView *responder = recursiveFirstResponderSearchInView(self);
return responder;
}
@end
I got two apps accepted this week, both using the September 8 version
(969d6f6, extended with some bugfixes).
--
Regards,
Eelco Lempsink
I should add that TTMessageController does not use firstResponder WRT
UIWindow. It just has text strings to store which text field was the
firstResponder during persist/restoreView calls. Should have looked
closer in Project Find but I never use the class and don't include in
my local project variant.
Cheers,
David