我需要使用全尺寸图片作为背景,我需要该图片有一个亮度滤镜.
现在它只用于Chrome和Firefox最后一个使用svg.
这就是我所拥有的:
img.fullscreenIMG
{
display:block;
position:absolute;
z-index:1;
filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' ><filter id='bright30'><feComponentTransfer><feFuncR type='linear' slope='0.30'/><feFuncG type='linear' slope='0.30' /><feFuncB type='linear' slope='0.30' /></feComponentTransfer></filter></svg>#bright30");
filter: brightness(0.6);
-webkit-filter: brightness(0.6);
-moz-filter: brightness(0.6);
-o-filter: brightness(0.6);
-ms-filter: brightness(0.6);
}
Run Code Online (Sandbox Code Playgroud)
Safari 5.1.7 for Windows也不适用于此Internet Explorer 11.
我错过了什么?你能推荐我任何其他方法来实现同样的目标吗?
谢谢
我正在使用a collectionView来显示图像Coredatabase.但是,除了numberOfItemsInSection&之外,没有任何方法被调用numberOfSectionsInCollectionView.代理和数据源设置正确.
单元格的标识符是photoCell,类是JLTPhotoCell.
- (void)viewDidLoad
{
[super viewDidLoad];
_thumbNails = [[NSArray alloc]init]; // its declared ,don't worry about this
_thumbNails = [[LADataModelController getSingleton] getAllSignatures];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
[layout setItemSize:( CGSizeMake(50,50))];
[_collectionView setCollectionViewLayout:layout];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
[_collectionView registerClass:[JLTPhotoCell class] forCellWithReuseIdentifier:@"photoCell"];
[self.view addSubview:self.collectionView];
self.collectionView.allowsSelection = true;
}
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section
{
NSLog(@"count %i" , _thumbNails.count);
return _thumbNails.count;
}
- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView
{
return 1;
} …Run Code Online (Sandbox Code Playgroud) iOS 8及更高版本中不推荐使用'push'.
这是我遇到的问题......

如何连接ViewController?
所以我有这个缩放的函数,UIImages我用它来初始化一个UIImageView图像。我的问题是当显示图像时,它周围总是有一个黑色矩形,尽管图像是背景中完全透明的 .png。
这是缩放方法以及 的初始化UIImageView:
- (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
if ([[UIScreen mainScreen] scale] == 2.0) {
UIGraphicsBeginImageContextWithOptions(newSize, YES, 2.0);
} else {
UIGraphicsBeginImageContext(newSize);
}
} else {
UIGraphicsBeginImageContext(newSize);
}
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
- (void)addMass:(Mass *)mass{
UIImageView *image = [[UIImageView alloc]initWithImage:[self imageWithImage:[UIImage imageNamed:@"circle.png"] scaledToSize:CGSizeMake(mass.mass, mass.mass)]];
[image setBackgroundColor:[[UIColor alloc]initWithRed:0 green:0 blue:0 alpha:1]];
image.center = [mass position];
[image setBackgroundColor:[UIColor clearColor]];
[massImages …Run Code Online (Sandbox Code Playgroud) 我试图根据用户选择的第一个分段控件中的选择启用/禁用2个不同的分段控件中的某些段.
第一段:黑色| 红色| 绿色|
第二段:0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
第三部分:| 19 | ..... | 36 | 00 |
我想要的功能是,如果用户选择黑色,那么只有第二和第三段中的某些数字应该触发为.enabled = YES
由于第二段和第三段需要第一段的初始输入,因此我在-ViewDidLoad中完全禁用了段
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
//not sure which one to use and why
[self.secondSegment setEnabled:NO]; …Run Code Online (Sandbox Code Playgroud)