小编iEn*_*eer的帖子

在iOS7中删除UISearchBar的边框

我正试图在iOS 7中删除UISearchBar的边框.在iOS 6中,它工作正常.我以编程方式创建了UISearchBar.我几乎尝试了Stack Overflow和Google的所有内容.

SearchBar正在寻找
SearchBar正在寻找

我想要实现的目标
我想要实现的目标

我尝试了下面提到的所有这些东西

searchBar.layer.borderWidth = 1;
searchBar.layer.borderColor = [[UIColor whiteColor] CGColor];
Run Code Online (Sandbox Code Playgroud)

for (id img in searchBar.subviews)
{       
     if ([img isKindOfClass:NSClassFromString(@"UISearchBarBackground")])
     {     
            [img removeFromSuperview];    
     }
} 
Run Code Online (Sandbox Code Playgroud)

for (UIView *sub in self.tableView.tableHeaderView.subviews) {
    if ([sub isKindOfClass:[UIImageView class]]) {
        sub.hidden = YES;
    }
}  
Run Code Online (Sandbox Code Playgroud)

但仍然没有成功.

uisearchbar ios

48
推荐指数
5
解决办法
4万
查看次数

UIImageJPEGRepresentation占用大量内存

我试图找出这个问题,但在做了我在OS或谷歌上发现的所有事情后失败了.问题是,当我转换UIImageNSData使用UIImageJPEGRepresentationUIImagePNGRepresentation它将内存大小增加到30Mb(相信我或不相信).
这是我的代码

myImage= image;
LoginSinglton*loginObj = [LoginSinglton sharedInstance];
NSError *error;
NSData *pngData = UIImageJPEGRepresentation(image, scaleValue); //scaleVale is 1.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0]; //Get the docs directory

self.imageCurrentDateAndTime =[self getTimeAndDate];
 self.filePathAndDirectory = [documentsPath stringByAppendingPathComponent:@"Photos Dir"];

NSLog(@"Documents path %@",self.filePathAndDirectory);
if (![[NSFileManager defaultManager] createDirectoryAtPath:self.filePathAndDirectory
                               withIntermediateDirectories:NO
                                                attributes:nil
                                                     error:&error])
{
    NSLog(@"Create directory error: %@", error);
}
self.imageName= [NSString stringWithFormat:@"photo-%@-%@.jpg",loginObj.userWebID,self.imageCurrentDateAndTime];
 NSString *filePath = [self.filePathAndDirectory stringByAppendingPathComponent:self.imageName];

[pngData writeToFile:filePath atomically:YES]; //Write the file …
Run Code Online (Sandbox Code Playgroud)

objective-c uiimage ios

4
推荐指数
1
解决办法
6480
查看次数

标签 统计

ios ×2

objective-c ×1

uiimage ×1

uisearchbar ×1