我在@echo off
for /f "skip=4 tokens=1" %%a in (result.txt) do (
set "word2=%%a"
goto :next
)
:next
echo %word2%
pause
应用程序中使用iCarousel
。每个轮播objective-c
都包含view
。所以在
image
我将-(UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view
设置为:
image
此行中的应用程序崩溃。这就是错误:
[carouselImage setImageWithURL:[NSURL URLWithString:myStringUrl] placeholderImage:[UIImage imageNamed:placeholderImage]];
当我搜索到这一点时,我发现许多解决方案建议在 -[CarouselUIView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CarouselUIView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x123d10a70'
使用-ObjC
标志,但我已经有了这个标志。
修改:附加代码
这是我的功能的全部代码:
Build Settings
-(UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view {
UIImageView * carouselImage;
if (view == nil) {
NSData *tempArchiveView = [NSKeyedArchiver archivedDataWithRootObject:self.carouselItemView];
CarouselUIView * carousselView = [NSKeyedUnarchiver unarchiveObjectWithData:tempArchiveView];
view = carousselView;
}
carouselImage = (UIImageView *) [view viewWithTag:0];
[carouselImage setImageWithURL:[NSURL URLWithString: myStringUrl] placeholderImage:[UIImage imageNamed:imagePlaceholder]];
return view;
}
:
CarouselView
答案 0 :(得分:1)
从查看给定代码开始,使用imageView初始化视图的行有问题。
[view viewWithTag:0];
必须将标记值更改为其他 0 。因为默认情况下所有视图的标记属性都设置为 0 。
快乐编码:)
答案 1 :(得分:0)
试试这可能对你有所帮助。 如果轮播包含仅限ImageView
-(UIView *) carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view{
UIImageView *imageView = (UIImageView *)view;
if (!imageView) {
imageView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ViewWidth(carousel), 250)];
imageView.tag = 100;
}
[imageView setImageWithURL:[NSURL URLWithString: myStringUrl] placeholderImage:[UIImage imageNamed:imagePlaceholder]];
return imageView;
}