关于如何在App中显示PDF有很多资源UIView
.我现在正在做的是从中创建一个PDF UIViews
.
例如,我有一个UIView
,与像Textviews子视图,UILabels
,UIImages
,所以我怎么能转换成一个大的 UIView
整体,包括其所有子视图和subsubviews到PDF?
我查看过Apple的iOS参考资料.但是,它只涉及将文本/图像片段写入PDF文件.
我面临的问题是我想以PDF格式写入文件的内容很多.如果我将它们逐个写入PDF,那将是一项巨大的工作.这就是我寻找写入UIViews
PDF甚至位图的方法的原因.
我已经尝试过在Stack Overflow中从其他Q/A复制的源代码.但它只给我一个带有UIView
边界大小的空白PDF .
-(void)createPDFfromUIView:(UIView*)aView saveToDocumentsWithFileName:(NSString*)aFilename
{
// Creates a mutable data object for updating with binary data, like a byte array
NSMutableData *pdfData = [NSMutableData data];
// Points the pdf converter to the mutable data object and to the UIView to be converted
UIGraphicsBeginPDFContextToData(pdfData, aView.bounds, nil);
UIGraphicsBeginPDFPage();
// draws rect to the view and thus this is …
Run Code Online (Sandbox Code Playgroud) 我正在使用某人的源代码来使用AVCaptureSession捕获图像.但是,我发现CaptureSessionManager的previewLayer是最后捕获的图像.
我发现得到的图像总是比率为720x1280 = 9:16.现在我想将结果图像裁剪为比例为320:480的UIImage,以便它只捕获previewLayer中可见的部分.任何的想法?非常感谢.
stackoverflow中的相关问题(还没有很好的答案): Q1, Q2
源代码:
- (id)init {
if ((self = [super init])) {
[self setCaptureSession:[[[AVCaptureSession alloc] init] autorelease]];
}
return self;
}
- (void)addVideoPreviewLayer {
[self setPreviewLayer:[[[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]] autorelease]];
[[self previewLayer] setVideoGravity:AVLayerVideoGravityResizeAspectFill];
}
- (void)addVideoInput {
AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (videoDevice) {
NSError *error;
if ([videoDevice isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus] && [videoDevice lockForConfiguration:&error]) {
[videoDevice setFocusMode:AVCaptureFocusModeContinuousAutoFocus];
[videoDevice unlockForConfiguration];
}
AVCaptureDeviceInput *videoIn = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
if (!error) {
if ([[self captureSession] canAddInput:videoIn])
[[self captureSession] …
Run Code Online (Sandbox Code Playgroud) 我正在努力将iOS6的CoreData + iCloud升级到iOS7.根据Apple的WWDC视频,当CoreData准备好iCloud核心数据存储时,"CoreData:Ubiquity:使用本地存储:1"将成为"CoreData:Ubiquity:使用本地存储:0".
我已经在模拟器上成功测试了这个.有趣的是,这永远不会发生在我的iPhone 5,我在检查的iCloud设置设置,但仍然没有运气.
下面的图片是xCode的iCloud Debugging面板的截图.有趣的是,有一个baseline.zip文件,我永远无法得到它的电流.这应该是来自iOS6的iCloud的僵尸文件......它有关系吗?
任何帮助表示赞赏.
谢谢.
经过一些研究,我发现有一些网站(例如http://www.topappcharts.com)和应用程序可以显示特定应用程序的排名.但是,该图表仅显示应用程序排名在前200名内的时段.
我的问题是,是否有一些官方API或非官方API我可以调用以获得我的应用程序的排名位置(即使它的位置大约是500,1000).
或者,按页面查询,如iTunes AppStore显示.逐页查找目标应用程序,并按页面x20 +当前页面内的位置计算位置.可能吗?
谢谢
我有一个简单的线性布局用于ListView的单元格,它有一个imageview.图像将从互联网上下载,因此尺寸可以是不同的尺寸.
但是,我想将imageview的宽度设置为fill_parent,这是固定的,并在运行时动态更改图像高度.设置图像高度的规则:如果图像的h/w比率大于1,则使ImageView正方形,表示将高度与宽度匹配.
如果图像的h/w比率小于1,则按比例调整大小.预计如下两个样本.
第一个是h/w <1,而第二个'Cat'是h/w> 1.
谢谢你的时间.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="@+id/postTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/postImg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:scaleType="centerCrop"
android:src="@drawable/dummy_image"
android:contentDescription="@string/postImage" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我有一个新的应用程序在不久的将来推出.从UI语言和App内容的一部分来看,App将针对不同的Territory的App Store提供不同的版本.
我的问题是我是否可以使用相同的应用程序包名称创建不同的应用程序(不同的软件包ID和不同的应用程序的iTunes应用程序名称).
我这样做是因为如果我在一个二进制文件中包含所有语言的所有UI图像并用代码控制语言更改,那么App大小将超过20 MG,这是我不想要的.因此,我决定分别创建,编译和提交不同的二进制文件,同时通过"权利和定价"设置其可用的App商店,并为每个版本选择特定国家/地区.我将确保我的应用程序的两个版本不会出现在同一个App Store中以混淆用户.
这可能吗?有没有人这样做过?
谢谢