我目前正在创建一个应用程序(iPhone/iPad/Android),它使用地图来显示租赁公司提供的房屋.该应用程序在所有商店免费.
我已阅读条款并了解本条款:
Use of the Google Geocoding API is subject to a query limit of 2,500 geolocation requests per day. (User of Google Maps API for Business may perform up to 100,000 requests per day.) This limit is enforced to prevent abuse and/or repurposing of the Geocoding API, and this limit may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the 24-hour limit …
我正在尝试将图像和视频结合起来.我将它们组合并输出但是它是旋转的侧面方式.
很抱歉批量代码粘贴.我已经看到了关于应用变换的答案,compositionVideoTrack.preferredTransform但是什么也没做.添加AVMutableVideoCompositionInstruction也没有做任何事情.
我觉得这个区域是事情开始出错的地方.这儿这儿:
// I feel like this loading here is the problem
let videoTrack = videoAsset.tracksWithMediaType(AVMediaTypeVideo)[0]
// because it makes our parentLayer and videoLayer sizes wrong
let videoSize = videoTrack.naturalSize
// this is returning 1920x1080, so it is rotating the video
print("\(videoSize.width) , \(videoSize.height)")
Run Code Online (Sandbox Code Playgroud)
所以在这里我们的帧大小对于该方法的其余部分是错误的.现在,当我们尝试去创建叠加图像层时,框架不正确:
let aLayer = CALayer()
aLayer.contents = UIImage(named: "OverlayTestImageOverlay")?.CGImage
aLayer.frame = CGRectMake(0, 0, videoSize.width, videoSize.height)
aLayer.opacity = 1
Run Code Online (Sandbox Code Playgroud)
这是我完整的方法.
func combineImageVid() {
let path = NSBundle.mainBundle().pathForResource("SampleMovie", ofType:"MOV")
let fileURL = NSURL(fileURLWithPath: …Run Code Online (Sandbox Code Playgroud) 我正在尝试将简单的分析事件记录到Firebase,但没有任何内容在线显示.
以下是我记录事件的方式:
FIRAnalytics.logEventWithName("spot_view", parameters: [
"spot_name": spotName,
"is_private": isPrivate
])
Run Code Online (Sandbox Code Playgroud)
我有运行时参数来查看Firebase输出,我得到了这个:
<FIRAnalytics/DEBUG> Event logged. Event name, event params: spot_view, {
"_o" = app;
"is_private" = 1;
"spot_name" = TestLogSpotView;
}
Run Code Online (Sandbox Code Playgroud)
所以事件正在被触发.我也明白了数据实际上传了:
2016-06-09 12:12:13.567 [60279:] <FIRAnalytics/DEBUG> Measurement data sent to network. Timestamp (ms), data: 1465488733550, <ACPMeasurementBatch 0x7de7bb60>: {
bundles {
protocol_version: 1
events {
params {
name: "_c"
int_value: 1
}
params {
name: "_o"
string_value: "auto"
}
name: "_f"
timestamp_millis: 1465488710347
}
events {
params {
name: "_et"
int_value: 1 …Run Code Online (Sandbox Code Playgroud) 我有一个UITextView内部UIViewController使用自动布局将其固定为0(因此它填满整个屏幕).我也推动使用这个视图UINavigationController.
我遇到了一个奇怪的错误,如果UITextView有足够的文本使它在屏幕上运行,那么内容将被设置在UINavigationBar.如果没有足够的文本来填充屏幕,则文本的布局不会在UINavigationBar.
这是正在发生的事情,这是当有足够的文本它离开屏幕,你需要滚动查看所有这些.

我试过了:
设置内容的插入UITextView.
确保UINavigationBar它不是半透明的.
尝试设置这个 self.automaticallyAdjustsScrollViewInsets = NO;
objective-c uitextview uinavigationcontroller ios autolayout
我有一个UIViewController.在那是UITableView它在原产地绘制0,0.我也有一个UIScrollView被绘制,0,-80以便它在屏幕外,不可见.
当按下一个菜单按钮时,我将该UIViewController帧的动画设置为80px,以显示该帧UIScrollView.
这里的问题是UIScrollView根本没有回应.
如果我绘制UIScrollViewat the say 0,0,它在加载时可见,它可以正常工作.我甚至可以在屏幕上制作动画,然后返回屏幕,没有任何问题.
以下是我的视图在动画制作之前的样子:
_____________________________
| | Frame -> (0,-80, 320, 80)
| ScrollView | **Offscreen**
|_____________________________|
| | <- Original view (0,0,320,480)
| |
| |
| |
| |
| |
| Original View |
| |
| |
| |
| |
| |
| |
| |
| | …Run Code Online (Sandbox Code Playgroud) 我的应用跟踪用户CLLocationManager.在委托电话中,didUpdateToLocation我做了所有有趣的事情来保存他们的位置.但是,我需要一种方法来测试它们是否已停止.我可以停止记录位置并考虑他们的旅行.所以我有一个NSTimer在CCLocationManager那个被添加,每次取出didUpdateToLocation被调用.当用户停止并CLLocationManager停止被叫时,它将被启动.
我能够完成NSTimer工作的唯一方法是:
[[NSRunLoop mainRunLoop] addTimer:userStoppedMovingTimer forMode:NSRunLoopCommonModes];
Run Code Online (Sandbox Code Playgroud)
然后删除它:
[userStoppedMovingTimer invalidate];
Run Code Online (Sandbox Code Playgroud)
我以前从来没有像这样添加计时器.有人可以解释为什么会这样吗?
我试图通过其他以及Apple的例子.我迷路了.
我有一个单例类,用于处理我的用户登录(挑战Web服务器等).
我想创建一个我可以调用的块,传入用户名/密码.该块将执行Web服务调用,如果成功则返回.
这是我到目前为止工作的目标:
我的单例类看起来像这样:
.H
typedef void (^AMLoginBlock)(NSString *userName, NSString *password);
@interface AuthManager : NSObject
+ (id)sharedManager;
+ (bool)loginUserWithBlock:(AMLoginBlock)block;
@end
Run Code Online (Sandbox Code Playgroud)
.M
@implementation AuthManager
+ (id)sharedManager
{
static dispatch_once_t pred = 0;
__strong static id _sharedObject = nil;
dispatch_once(&pred, ^{
_sharedObject = [[self alloc] init]; // or some other init method
});
return _sharedObject;
}
+ (bool)loginUserWithBlock:(AMLoginBlock)block {
NSLog(@"im printing from AM");
return true;
}
@end
Run Code Online (Sandbox Code Playgroud)
然后我调用这样的方法:
bool rtn = [AuthManager loginUserWithBlock:^(NSString *userName, NSString *password) {
NSLog(@"im here in the …Run Code Online (Sandbox Code Playgroud) 我似乎无法registerUserNotificationSettings在iOS 8.1或8.2中显示提示.
这是我正在做的事情didFinishLaunchingWithOptions:
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
#ifdef __IPHONE_8_0
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert
|UIUserNotificationTypeSound | UIUserNotificationTypeBadge) categories:nil];
NSLog(@"Reg settings %@", settings);
[application registerUserNotificationSettings:settings];
#endif
}
Run Code Online (Sandbox Code Playgroud)
也可以在这里收到正确的电话:
- (void)application:(UIApplication *)application
didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{
NSLog(@"Did register - %@", notificationSettings);
}
Run Code Online (Sandbox Code Playgroud)
但是没有显示任何提示.更令人讨厌的是,当设备被锁定时会显示警报,但不会发出通知警报声.关于解决方案的任何想法?
我试图在给定的时间段后自动锁定设备.我见过的唯一能让这成为可能的是这样做:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
UIApplication.sharedApplication().idleTimerDisabled = true
NSTimer.scheduledTimerWithTimeInterval(30, target: self, selector: "lockScreen", userInfo: nil, repeats: false)
return true
}
func lockScreen() {
print("locking screen")
UIApplication.sharedApplication().idleTimerDisabled = false
}
Run Code Online (Sandbox Code Playgroud)
但它似乎不起作用.还有其他选择吗?市场上有一款名为CellControl的应用程序可以做到这一点,所以我知道它是可能的,似乎无法弄清楚如何.
我也试过从这个答案中取得的obj-c
这是他们的应用程序工作的剪辑,从公共应用程序商店下载.您可以看到,只要我按下主页按钮并退出应用程序,它们就会强行锁定屏幕.
我也看到使用私有框架,这肯定会要求拒绝:
char *gsDylib = "/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices";
void *handle = dlopen(gsDylib, RTLD_NOW);
if (handle) {
BOOL locked = FALSE;
void (*_GSEventLockDevice)() = dlsym(handle, "GSEventLockDevice");
if (_GSEventLockDevice) {
_GSEventLockDevice();
//...
}
dlclose(handle);
//... …Run Code Online (Sandbox Code Playgroud) 我有以下课程:
import UIKit
class HeaderTableViewController: UITableViewController {
var nonDefaultTitle : String?
var data: [String: [String]] = [:]
var headers : [String] = []
var bodys : [[String]] = []
init(displayData: [String: [String]]) {
super.init(style: .Grouped)
data = displayData
for key in data.keys {
headers.append(key)
}
for arr in data.values {
bodys.append(arr)
}
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
override func …Run Code Online (Sandbox Code Playgroud) ios ×8
objective-c ×6
swift ×3
xcode ×2
analytics ×1
android ×1
autolayout ×1
camera ×1
firebase ×1
google-maps ×1
iphone ×1
nsrunloop ×1
nstimer ×1
orientation ×1
singleton ×1
uiscrollview ×1
uitextview ×1
uiview ×1