我想在滚动视图中显示多个图像,当图像超过70应用程序将崩溃并显示收到的内存错误.我从文档目录中获取图像
我试过了 -
UIScrollView *MyScroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
int x=5,y=15;
for (int i = 0; i < imgarr.count; i++)
{
if(x<=211)
{
UIImage* imagePath = [UIImage imageWithContentsOfFile:[path_array objectAtIndex:i]];
imgView=[[UIImageView alloc]initWithFrame:CGRectMake(x, y, 77, 75)];
imgView.image=imagePath;
imgeBtn=[UIButton buttonWithType:UIButtonTypeCustom];
imgeBtn.frame=CGRectMake(x, y, 93, 110);
[imgeBtn addTarget:self action:@selector(btnclick:) forControlEvents:UIControlEventTouchUpInside];
imgeBtn.tag=i;
x+=103;
}
else
{
x=5;
y+=130;
UIImage* imagePath = [UIImage imageWithContentsOfFile:[path_array objectAtIndex:i]];
imgView=[[UIImageView alloc]initWithFrame:CGRectMake(x, y, 77, 75)];
imgView.image=imagePath;
imgeBtn=[UIButton buttonWithType:UIButtonTypeCustom];
imgeBtn.frame=CGRectMake(x, y, 93, 110);
[imgeBtn addTarget:self action:@selector(btnclick:) forControlEvents:UIControlEventTouchUpInside];
imgeBtn.tag=i;
x+=103;
}
[MyScroll addSubview:imgeBtn];
[MyScroll …Run Code Online (Sandbox Code Playgroud) 我是Photo framework的新手,我不知道如何使用它.我使用了很多链接,但我很困惑如何在imageview中显示图像.
我想通过照片框架从画廊获取所有照片我正在尝试
NSMutableOrderedSet *recentsDataSource;
PHFetchResult *assetCollection = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum | PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:nil];
for (PHAssetCollection *sub in assetCollection)
{
PHFetchResult *assetsInCollection = [PHAsset fetchAssetsInAssetCollection:sub options:nil];
for (PHAsset *asset in assetsInCollection)
{
[self.recentsDataSource addObject:asset];
}
}
if (self.recentsDataSource.count > 0)
{
NSArray *array = [self.recentsDataSource sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]]];
NSLog(@"Photo Array : %@",array);
self.recentsDataSource = [[NSMutableOrderedSet alloc]initWithArray:array];
}
Run Code Online (Sandbox Code Playgroud)
我有这种类型的数组.
照片阵列:("5A2ABD38-D724-42B1-939A-F557D5CCE9FC/L0/001 mediaType = 1/0,sourceType = 1,(328x328),creationDate = 2015-10-14 06:06:22 +0000,location = 0 ,hidden = 0,favorite = 0","5391482F-9887-4518-9976-D5D544CDF8CA/L0/001 mediaType = 1/0,sourceType = 1,(450x800),creationDate …
我创建了一个应用程序来发布图像和文本,Facebook但我的客户要求是在不打开任何对话框和 safari 浏览器的情况下发布图像和文本。
我可以在Facebook不打开任何对话框或 Safari 的情况下使用用户 ID发布图像和文本吗?
我试过了 :
1) SLComposeViewController但它会首先打开共享对话框。
2) FBSDKShareDialog但它会进入 Safari 浏览器。
我需要Facebook在后台发布图像和文本。
Createa定制项目TabBar,在其工作完美iOS多达9个,但iOS 10我有一个问题TabBar上的顶线TabBar。
尝试了以下代码:
UITabBarController *Tabbar;
[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
Run Code Online (Sandbox Code Playgroud)
它的工作在iOS9not in iOS10。我试图将其应用于TabBar
1)尝试:
[Tabbar.tabBar setShadowImage:[[UIImage alloc] init]];
Tabbar.tabBar.layer.borderWidth = 0.0f;
Tabbar.tabBar.layer.borderColor =[UIColor clearColor].CGColor;
Tabbar.tabBar.layer.backgroundColor=[UIColor clearColor].CGColor;
Tabbar.tabBar.tintColor=CLEAR_COLOR;
Tabbar.tabBar.barTintColor=CLEAR_COLOR;
Run Code Online (Sandbox Code Playgroud)
2)尝试:
CALayer * superLayer = [UITabBar appearance].layer;
CALayer * layer = [CALayer layer];
layer.bounds = CGRectMake (0.0f, 0.0f, 62.0f, 56.0f);
layer.contents = (id) [UIImage imageNamed: @"tras_tabbg-min"].CGImage;
layer.anchorPoint = CGPointMake (0.5f, 1.0f);
layer.position = CGPointMake (superLayer.bounds.size.width / 2.0f, superLayer.bounds.size.height); …Run Code Online (Sandbox Code Playgroud)