iPhone Curl Left и Вихревые Правильные переходы

Альтернатива строкам формата должна была бы использовать zfill строки () метод:

y = [str(i).zfill(2) for i in x]

Другая вещь: Вы могли бы после дополнять на основе самого большого объекта в списке, таким образом, вместо того, чтобы просто использовать 2, Вы могли сделать:

pad_length = len(str(max(x)))
y = [str(i).zfill(pad_length) for i in x]
9
задан Dimitris 26 October 2009 в 15:06
поделиться

3 ответа

Мне действительно удалось добиться этого эффекта, изменив ориентацию моего UIViewController. Странно то, что мой контроллер был установлен в другом, когда он не работал, но когда я установил его как непосредственный контроллер представления, он заработал.

Код, который это делает:

В UIViewController, который является контроллер основного представления в моем делегате приложения и разрешает только альбомную ориентацию (как вы видите во втором методе ниже), у меня есть следующее:

-(void)goToPage:(int)page flipUp:(BOOL)flipUp {

     //do stuff...

     // start the animated transition
     [UIView beginAnimations:@"page transition" context:nil];
     [UIView setAnimationDuration:1.0];
     [UIView setAnimationTransition:flipUp ? UIViewAnimationTransitionCurlUp : UIViewAnimationTransitionCurlDown forView:self.view cache:YES];

     //insert your new subview
     //[self.view insertSubview:currentPage.view atIndex:self.view.subviews.count];

      // commit the transition animation
      [UIView commitAnimations];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
4
ответ дан 4 December 2019 в 12:19
поделиться

I don't think there is a way beyond writing a custom animation.

More importantly you probably shouldn't try to it. The curl up and curl down are part of the user interface grammar that tells the user that a view is being lifted up or put down over the existing view. It's supposed to be like a sticky note being put down and then removed. A left<->right curl will most likely be interpreted as the something like ripping a page out of a book. It will confuse users.

Whenever you find yourself trying to do something in the interface that the standard API doesn't do easily, you should ask yourself whether such a novel method will communicate something important to user and whether it is similar to the existing interface grammar. If not, then you shouldn't bother.

Unusual interfaces have an initial wow factor but they lead to frustration and errors in day-to-day use. They can also cause Apple to refuse your app.

0
ответ дан 4 December 2019 в 12:19
поделиться

С помощью представления контейнера можно делать завивки в любом из четырех направлений. Установите желаемый угол для преобразования представления контейнера, а затем выполните скручивание, добавив ваше представление к представлению контейнера, а не основное представление вашего приложения, которое не имеет преобразованного фрейма:

NSView* parent = viewController.view; // the main view
NSView* containerView = [[[UIView alloc] initWithFrame:parent.bounds] autorelease];
containerView.transform = CGAffineTransformMakeRotation(<your angle here, should probably be M_PI_2 * some integer>);
[parent addSubview:containerView]; 

[UIView beginAnimations:nil context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:containerView cache:YES];
[containerView addSubview:view];
[UIView commitAnimations];
9
ответ дан 4 December 2019 в 12:19
поделиться
Другие вопросы по тегам:

Похожие вопросы: