我需要为我的iPhone应用程序使用UIPopOverController,我搜索stackoverflow有人说UIPopoverController不能在iphone设备上运行为什么?.当我在iphone设备上运行时我得到了这个错误 reason: '-[UIPopoverController initWithContentViewController:]
called when not running under UIUserInterfaceIdiomPad.'
-(void)btnSetRemainderTapped:(UIButton *)button
{
setReminderView =[[SetRemainderView alloc]initWithNibName:@"SetRemainderView" bundle:[NSBundle mainBundle]];
setReminderView.contentSizeForViewInPopover = CGSizeMake(setReminderView.view.frame.size.width, setReminderView.view.frame.size.height);
setReminderView.delegate = self;
popOverController = [[UIPopoverController alloc]
initWithContentViewController:setReminderView] ;
CGRect rect = CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2, 1, 1);
[popOverController presentPopoverFromRect:rect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
谁能帮我?
我正在使用iOS5书来学习iOS编程.
@synthesize coolWord;
Run Code Online (Sandbox Code Playgroud)
^ synthesize用于.m文件中的所有属性
我听说在iOS6中不需要合成,因为它是自动完成的.这是真的?
合成是否对iOS6起任何作用?
谢谢你的澄清.:)
我想弄清楚当屏幕第一次加载时如何一直滚动到UICollectionView的底部.触摸状态栏时我可以滚动到底部,但我希望能够在视图加载时自动执行此操作.如果我想在触摸状态栏时滚动到底部,下面的工作正常.
- (BOOL)scrollViewShouldScrollToTop:(UITableView *)tableView
{
NSLog(@"Detect status bar is touched.");
[self scrollToBottom];
return NO;
}
-(void)scrollToBottom
{//Scrolls to bottom of scroller
CGPoint bottomOffset = CGPointMake(0, collectionViewReload.contentSize.height - collectionViewReload.bounds.size.height);
[collectionViewReload setContentOffset:bottomOffset animated:NO];
}
Run Code Online (Sandbox Code Playgroud)
我试过在viewDidLoad中调用[self scrollToBottom].这不起作用.有关如何在视图加载时滚动到底部的任何想法?
有没有人知道如何在显示集合视图时重新加载/刷新UICollectionView?基本上我正在为UITableview寻找类似于标准reloadData方法的东西.
我的一个标签(在我的基于选项卡的应用程序中)适用于iOS 9,但在iOS 8上不起作用.具体来说,当尝试从plist加载数据时,我得到如下所示的错误.
我有一个"Planner"选项卡,可以将条目保存到plist中.iOS 8错误 - reason: '*** -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x62, 0x70, 0x6c, 0x69, 0x73, 0x74, 0x30, 0x30)'
保存代码:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
plistPath = appDelegate.plistPathInDocument
plistPath2 = appDelegate.plist2PathInDocument
// Extract the content of the file as NSData
let data:NSData = NSFileManager.defaultManager().contentsAtPath(plistPath)!
let data2:NSData = NSFileManager.defaultManager().contentsAtPath(plistPath2)!
do{
if(numOfViewWillAppear == 0)
{
if let x = NSKeyedUnarchiver.unarchiveObjectWithData(data2)
{
self.sortedSections = NSKeyedUnarchiver.unarchiveObjectWithData(data2) as! [String]
self.sections = NSKeyedUnarchiver.unarchiveObjectWithData(data) as! Dictionary
}
numOfViewWillAppear++
}
}
Run Code Online (Sandbox Code Playgroud)
和AppDelegate准备代码:
func preparePlist()
{
let …
Run Code Online (Sandbox Code Playgroud) -(NSString *) nibName
{
PO([self class]);
PO([super class]);
PO([self superclass]);
Run Code Online (Sandbox Code Playgroud)
只[self superclass]
产生实际的超类.
[self class]: BGImageForBizs
[super class]: BGImageForBizs
[self superclass]: BGUIImageWithActivityIndicator
Run Code Online (Sandbox Code Playgroud) 在我们的应用程序中,我们有消息列表.我们正在转向RecyclerView
.我们的消息可以包括文本,图像.示例消息可能如下所示.
要处理点击,请使用此类:
public class RecyclerViewItemClickListener implement RecyclerView.OnItemTouchListener {
public static interface OnItemClickListener {
public void onItemClick(View view, int position);
public void onItemLongClick(View view, int position);
}
private OnItemClickListener mListener;
private GestureDetector mGestureDetector;
public RecyclerViewItemClickListener(Context context, final RecyclerView recyclerView, OnItemClickListener listener) {
mListener = listener;
mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapUp(MotionEvent e) {
return true;
}
@Override
public void onLongPress(MotionEvent e)
{
View childView = recyclerView.findChildViewUnder(e.getX(), e.getY());
if(childView != null && mListener != null) …
Run Code Online (Sandbox Code Playgroud) 我不确定我要问的是实际上是NSDictionary
多用键还是好的.
我想要做的是NSDictionary
为我的数据创建一个带键和值,然后将其转换为JSON
格式.该JSON
格式将看起来就像这样:
{
"eventData": {
"eventDate": "Jun 13, 2012 12:00:00 AM",
"eventLocation": {
"latitude": 43.93838383,
"longitude": -3.46
},
"text": "hjhj",
"imageData": "raw data",
"imageFormat": "JPEG",
"expirationTime": 1339538400000
},
"type": "ELDIARIOMONTANES",
"title": "accIDENTE"
}
Run Code Online (Sandbox Code Playgroud)
我只用过NSDictionaries
这样的:
NSArray *keys = [NSArray arrayWithObjects:@"eventDate", @"eventLocation", @"latitude" nil];
NSArray *objects = [NSArray arrayWithObjects:@"object1", @"object2", @"object3", nil];
dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
Run Code Online (Sandbox Code Playgroud)
但上述格式并非全部都与关键价值有关.所以我的问题是如何NSDictionary
适应JSON
格式?感谢您阅读我的帖子,对不起,如果有任何困惑.
这是github上的链接https://github.com/spennyf/cropVid/tree/master尝试一下你的自我,看看我在谈论它需要1分钟来测试.谢谢!
我正在拍摄带有正方形的视频,以显示vid的哪一部分将被裁剪.像这样:
现在我正在做一张纸,正方形有4条线,顶部和底部有半条线差异.然后我使用我将发布的代码裁剪视频,但是当我显示视频时,我看到了这个(忽略背景和绿色圆圈):
你可以看到有超过四行,所以我设置它来裁剪某个部分,但它增加了更多,当我使用相机中显示的相同矩形,以及用于裁剪的相同矩形?
所以我的问题是为什么裁剪的尺寸不一样?
这是我如何裁剪和显示:
//this is the square on the camera
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-80)];
UIImageView *image = [[UIImageView alloc] init];
image.layer.borderColor=[[UIColor whiteColor] CGColor];
image.frame = CGRectMake(self.view.frame.size.width/2 - 58 , 100 , 116, 116);
CALayer *imageLayer = image.layer;
[imageLayer setBorderWidth:1];
[view addSubview:image];
[picker setCameraOverlayView:view];
//this is crop rect
CGRect rect = CGRectMake(self.view.frame.size.width/2 - 58, 100, 116, 116);
[self applyCropToVideoWithAsset:assest AtRect:rect OnTimeRange:CMTimeRangeMake(kCMTimeZero, CMTimeMakeWithSeconds(assest.duration.value, 1))
ExportToUrl:exportUrl ExistingExportSession:exporter WithCompletion:^(BOOL success, NSError *error, NSURL *videoUrl) …
Run Code Online (Sandbox Code Playgroud) 我试图扭曲一个矩形,使两个垂直边倾斜但平行,顶部和底部是水平的.
我正在尝试使用CGAffineTransform并找到了这个代码,但我不知道要在各个部分放什么.
imageView.layer.somethingMagic.imageRightTop = (CGPoint){ 230, 30 };
imageView.layer.somethingMagic.imageRightBottom = (CGPoint){ 300, 150 };
#define CGAffineTransformDistort(t, x, y) (CGAffineTransformConcat(t, CGAffineTransformMake(1, y, x, 1, 0, 0)))
#define CGAffineTransformMakeDistort(x, y) (CGAffineTransformDistort(CGAffineTransformIdentity, x, y))
Run Code Online (Sandbox Code Playgroud)
虽然据说很容易,但我不知道在不同的地方放什么.
我假设图像视图将是我想要改变的图像,但是什么会变成什么样的魔法.和imageRightTop和imageRightBottom.
另外我如何定义t.
如果有一个更彻底的解释我会很感激,因为在大多数情况下我只发现这是解释如何扭曲矩形.
谢谢
ios ×7
objective-c ×6
iphone ×2
android ×1
avasset ×1
cgrect ×1
json ×1
key ×1
nsdictionary ×1
reloaddata ×1
swift ×1
uiimageview ×1
uiscrollview ×1
video ×1
xcode ×1