English 中文(简体)
承诺不会使我的UIImage重新成为现实。 观点概述
原标题:commitAnimations is not resizing my UIImageView subview

我以小话题发表了《国际调查》意见,我以小话补充了《国际调查评论》。

UIView *viewCreated;
UIButton *buttonCreated;
UIImageView *imageViewCreated;
CGRect myFrame = CGRectMake(0, 0, 1024, 1024);
viewCreated = [[UIView alloc] initWithFrame:myFrame];
[viewCreated setTag:intTag];
viewCreated.backgroundColor = [UIColor redColor];
[self.view addSubview:viewCreated];
[self randomize];
UIImage *d1Image = [UIImage imageNamed:[NSString stringWithFormat:@"image%d.png", randomNumber]];
imageViewCreated = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f,0.0f,1024.0f, 1024.0f)];
[imageViewCreated setImage:[UIImage imageNamed:[NSString stringWithFormat:@"image%d.png", randomNumber]]]; 
[viewCreated addSubview:imageViewCreated];
//[imageViewCreated release];
return [viewCreated autorelease];

但是,当该法典只执行第一个次调查时,该次调查是一次估计和重新规模的。 UiimageView将200个餐厅移至左边,但没有再造。

NSLog(@"sender tag %i",[sender tag]);   
UIView *currentView = [self.view viewWithTag:[sender tag]];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.5];  
currentView.frame = CGRectMake(-200, 0,40, 102);
[UIView commitAnimations];

我确信,我并没有在方案上正确地提出分观点,因为当我对建筑间进行施工时,它就能够发挥预期的作用。

我是否必须做一些具体的事情,才能把第二次次调查的行为归为第一个次调查?

最佳回答

我最后利用这一手段解决我的问题。 完美无缺。

imageViewCreated.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
问题回答

一些建议:

  • 采用<代码>contentMode的UIImageView的财产。 缺省模式为UIViewContentModeScale ToFill。 诸如<条码>的有些字条可能更好。

  • 在你的法典中,你一定会意外地将<代码>autoresizes Subviews 财产交给NO。

  • 考虑使用<代码>transform Property和CGAffine TransformMakeScale功能。 为了做到这一点,还可以使用<条码>CGAffine TransformMake Translation。





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签