未调用UIButton操作

bmu*_*ler 0 iphone objective-c uibutton ios

我有一个UIButton,我正在使用从XML文件解析的内容动态添加(它也被缓存).

我第一次运行应用程序时,按钮的动作没有被调用 - 但是它的图像和其他所有内容都加载得很好.我第二次运行应用程序,按钮工作.

关于为什么第一次运行应用程序时没有调用按钮动作的任何线索?

- (void)fetchHeader
{
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

    // Initiate the request...

    channel1 = [[FeedStore sharedStore] fetchFeaturedHeaderWithCompletion:
            ^(RSSChannel *obj, NSError *err) {

                if(!err) {
                    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

                    // Set our channel to the merged one
                    channel1 = obj;

                    RSSItem *d = [[channel1 items] objectAtIndex:0];
                    RSSItem *c = [[channel1 items] objectAtIndex:1];


                    NSString *param = [d photoURL]; // the URL from the XML
                    NSString *param1 = [c photoURL]; // the URL from the XML


                    featured1 = [[UIButton alloc] init];
                    [featured1 addTarget:self action:@selector(featuredButtonPress:) forControlEvents:UIControlEventTouchUpInside];
                    [featured1 setFrame:CGRectMake(18, 20, 123, 69)];
                    [featured1 setImageWithURL:[NSURL URLWithString:param] placeholderImage:[UIImage imageNamed:@"featuredheaderbg.png"]];
                    featured1.tag = 1;
                    [[self view] addSubview:featured1];
                }
       }];
}
Run Code Online (Sandbox Code Playgroud)

bmu*_*ler 6

问题是UIView正在掩盖它下面的按钮.因为视图是透明的,所以我没有意识到它覆盖了任何东西.