我使用Grand Central Dispatch方法在队列中执行我的应用程序的一些执行。我决定在该队列上计算按钮的帧。我希望我的应用能够在旋转后重新绘制缩放并计算新帧。下面是我做了一些伪代码解释:如何命名一段代码并用不同的方法调用它?
CGFloat a=123, b=24;
dispatch_async(drawingQue, ^{
//needed loops to get the total button count-how many ones will be drawn et..
for(int x=0;x<someCount<x++){
for(int y=0;y<anotherCount;y++){
//needed frame&name ect assingments
button.frame= CGRectMake(x+y, x-y, a, b);
[button setTitle:@"abc"];}}
};
这里我想是的,我怎么给这个区块的名称,并在
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
}
委托方法重新使用它呢?例如,如果旋转是风景,我想用a=234
而不是123 ..请任何帮助。在此先感谢..
重要的是要注意,提到“自我”或在自己藏在伊娃里的块内的任何伊娃都会产生保留周期,从而导致泄漏。你可以通过'__block id blockSelf = self;'指针引用ivars或者通过安排释放block _before_'dealloc'来打破循环。 – 2012-03-30 18:43:37