TTPhotoViewController: Images do not load until you swipe the screen

I am trying to implement TTPhotoViewControlleran example iPad application. I executed the protocols correctly TTPhotoSourceand TTPhoto. TTPhotoViewControllershows the image, but not until it is scrolled.

The right and left buttons on the tab bar below do not work at all, they never change the displayed image. UIActivityIndicatorViewnever put up, neither the right nor left buttons are checked when reaching the last or first images.

I initialize the subclass TTPhotoViewControlleras the rootViewController of the object UINavigationControllerthat I am adding to the view.

This eliminates the possibility of a problem: http://three20.stackexchange.com/questions/78/ttphotoviewcontroller-not-loading-images-immediately

What else am I missing? Has anyone encountered similar problems and found a way?

Thanks Raj

+3
source share
3 answers

After some debugging, I found a problem, this is just a quick fix:

In the TTModelViewController class of the Three20UI project, find the method

-refresh

and comment on the if condition:

if (_isViewAppearing)

In the end, a method -updateViewthat has not been called before will be called.

This is a quick fix, you need to investigate the bool issue: _isViewAppearinglater.

0
source

, viewWillAppear TTPhotoViewController, -.

+3

. TTPhotoSource modelDidFinishLoad: , ... TTPhotoViewController , .

, . , , TTPhotoViewController . , , TTP- modelDidFinishLoad: , .

, , TTModel, NSMutableArray, , .

... TTPhotoViewController...

// superDelegates KVO Mutator Methods

- (NSMutableArray*)delegates {
 return [self mutableArrayValueForKey:@"superDelegates"];
}

- (void)insertObject:(id)object inSuperDelegatesAtIndex:(NSUInteger)index {
 [super.delegates insertObject:object atIndex:index];

 if ([self isLoaded]) {
  if ([object respondsToSelector:@selector(modelDidFinishLoad:)]) {
   [object performSelector:@selector(modelDidFinishLoad:) withObject:self];
  }
 }
}

- (void)removeObjectFromSuperDelegatesAtIndex:(NSUInteger)index {
    [super.delegates removeObjectAtIndex:index];
}

- (NSArray*) superDelegates {
 return super.delegates;
}

"" superDelegates, NSArray, NSMutableArray. insertObject: inSuperDelegatesAtIndex: removeObjectFromSuperDelegatesAtIndex: "superDelegates", ( , ) mutableArrayValueForKey: -, NSMutableArray, superDelegates, insertObject: inSuperDelegatesAtIndex: removeObjectFromSuperDelegatesAtIndex:.

Then all you have to do is redefine the delegates method to return such a generated proxy, and poof, all changes to the array are triggered through you, which allows you to send the correct download notification when connecting to TTPhotoViewController.

+1
source

Source: https://habr.com/ru/post/1749368/


All Articles