English 中文(简体)
倡议指标 缩略语
原标题:UIActivityIndicatorView in an UIScrollview

我完全听了UIScroll电文,以显示我的形象。 在UIScroll 意见中添加了“倡议”词句,它 well好了,但是,在我进行滚动、循环、轮用时,它如何总是在屏幕中间形成。

最佳回答
In ur .h file

        UIView *primaryImage;
    UIView *secondaryImage;
    UIActivityIndicatorView *indicator;

In ur .m file 


-(void)indicatorView
{
    primaryImage = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)]; 
    primaryImage.backgroundColor = [UIColor blackColor];
    primaryImage.alpha =0.5;
    //[self.view.superview insertSubview:primaryImage aboveSubview:self.view.superview];

    //[theTableView addSubview:primaryImage];
    [self.view addSubview:primaryImage];

    secondaryImage = [[UIView alloc] initWithFrame:CGRectMake(127.50,215,65,50)];
    secondaryImage.backgroundColor = [UIColor blackColor];
    secondaryImage.alpha = 0.9;
    secondaryImage.layer.cornerRadius = 12;
    [primaryImage addSubview:secondaryImage];

    indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(30, 25, 25, 25)];
    indicator.center = CGPointMake(32, 25);
    //[indicator hidesWhenStopped];
    [indicator startAnimating];
    [secondaryImage addSubview:indicator];
}



-(void)dismissCoverImageView {

    [indicator stopAnimating];
    [indicator removeFromSuperview];
    [secondaryImage removeFromSuperview];
    [primaryImage removeFromSuperview]; 
}

and after that you can call         [self indicatorView];
and [self dismissCoverImageView];
问题回答

如果你在滚动观点中直接添加“倡议行动指标”意见,则该词将按滚动观点推移。 但是,如果你向发展趋势的母体补充,它将继续留在位置。 因此,解决办法是将其添加到滚动观点的括号中。

注:

我建议在你的窗口中配备一名国际笔记员,然后在国际笔记簿上添加这两份文件。

See the discussion here about adding views directly to your window:

意见主计长发出电文,尽管已处理

Define the UIScrollViewDelegate of your UIScrollView. And in the delegate method –(void)scrollViewDidScroll:(UIScrollView *)scrollView change the frame of UIActivityIndicator object.





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签