我有一个带有动画图像的UImageview.我在代码中添加uiimageview,它是CollectionViewCell的一部分当用户触摸动画停止的单元格时,为什么会发生这种情况?
码:
var images: [UIImage] = []
for i in 0...10 {
images.append(UIImage(named: "image\(i)"))
}
let i = UIImageView(frame: CGRect(x: xPos, y: yPos, width: 200, height: 200))
i.animationImages = images
i.animationDuration = 0.5
i.startAnimating()
i.contentMode = UIViewContentMode.Center
i.userInteractionEnabled = false
self.addSubview(i)
Run Code Online (Sandbox Code Playgroud) 我想在用户点击推送通知时打开浏览器.
在我的应用代表中,我有:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
var json = remoteNotif[UIApplicationLaunchOptionsRemoteNotificationKey] as! NSDictionary
storyboard = UIStoryboard(name: "Main", bundle: nil)
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let navC = storyboard.instantiateViewControllerWithIdentifier("mainNav") as! NavViewController
let data = json.objectForKey("data") as! NSDictionary
let url = data.objectForKey("url") as! String
UIApplication.sharedApplication().openURL(NSURL(string: url)!)
self.window?.rootViewController = navC
self.window?.makeKeyAndVisible()
}
Run Code Online (Sandbox Code Playgroud)
当用户点击推送通知时,这会给我一个黑屏20秒,然后打开应用程序,然后打开浏览器.如何只在浏览器上打开推送通知,或者至少打开超过20秒?
谢谢.
我有一个提要视图控制器(使用 UICollectionViewController 实现)当我没有足够的单元格来覆盖大厅屏幕高度时,刷新的拉动不起作用。我怎样才能解决这个问题?
代码:
var refreshControl: UIRefreshControl!
override func viewDidLoad() {
super.viewDidLoad()
self.refreshControl = UIRefreshControl()
self.refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh")
self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
self.postCollection.addSubview(refreshControl)
}
func refresh(sender:AnyObject)
{
getPost()
}
Run Code Online (Sandbox Code Playgroud)
编辑:不工作我的意思是不能拉下 uicollectionview 并且动画没有开始。
如果我有一个被用户关闭的活动(用户按下主页,所以应用程序仍在应用程序堆栈中),然后他收到通知,当他按下它时,我开始一个活动,现在同一个活动打开了两次。我怎样才能防止这种情况发生?
我的代码:
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManager mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.logo)
.setContentTitle("Title")
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setAutoCancel(true)
.setLights(GCMSIntentService.PURPLE, 500, 500)
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setContentText(msg);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(1, mBuilder.build());
Run Code Online (Sandbox Code Playgroud) android android-activity android-pendingintent google-cloud-messaging
我在github上创建了一个android库,我想添加到Gradle,其他人可以添加编译"我的项目..."到android build.我怎样才能将它上传到Gradle?
(我在任何地方都找不到答案)
编辑: 要清除我的问题,我想为开发人员发布一个库.
谢谢
我有一个UICollectioView工作正常.有两种方法可以访问此页面.
除了一个案例,一切都很好.
如果用户在聊天中,然后他退出应用程序(主页按钮),那么他会得到推送通知,他按下它并且应用程序崩溃.
崩溃:
2015-09-25 10:28:15.140 Quest [298:16922] *断言失败 - [UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:],/ BuildRoot/Library/Cache/com.apple.xbs/Sources/UIKit/UIKit-3505.16/UICollectionView.m:1519 2015-09-25 10:28:15.146任务[298:16922]* 终止应用程序由于未捕获的异常 'NSInternalInconsistencyException',理由是: 'UICollectionView数据源未设置'***第一掷调用堆栈:(0x1828b4f5c 0x1973b7f80 0x1828b4e2c 0x1837a3f3c 0x187f97a38 0x187e6ebd4 0x187e6fb54 0x187e69b88 0x187e0700c 0x18760df14 0x187608b20 0x1876089e0 0x18760807c 0x187607dd0 0x1880c0bd4 0x18286c48c 0x18286bdc4 0x182869d4c 0x182798dc0 0x18d8ec088 0x187e72f60 0x100215590 0x197be28b8)libc ++ abi.dylib:以NSException类型的未捕获异常终止
推送处理程序中的代码
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
let home = storyboard.instantiateViewControllerWithIdentifier("home") as! HomeViewController
let chat = storyboard.instantiateViewControllerWithIdentifier("chat") as! ChatViewController
var controllers : [UIViewController] = [login, chat]
NotificationManager.handleNotification(userInfo, controllers: &controllers, storyboard: storyboard)
navC.viewControllers = …Run Code Online (Sandbox Code Playgroud) 在启动我的应用程序时,我得到启动屏幕大约2-3秒,然后才出现我的第一个UIViewController.
有时我的ViewDIdAppear在UIViewController实际出现之前被调用.
我有一个非常大的故事板(15个屏幕).
我有一些标志,我从UserDefaults检查(用户已登录...),我初始化crashlytics和GCM.
因此标志和初始化似乎不是问题.
我检查了系统时间差异,似乎没问题.
调试慢启动的任何想法?
表格大小是否有限制?我需要平均每秒添加一次新数据.我正在从蓝牙设备保存信息,所以我会每秒钟获得应用程序处于前台/后台的更新.
谢谢
我想将图像添加到UIBarButtonItem.
我的代码:
let button1 = UIBarButtonItem(image: UIImage(named: "icon1"), style: .Plain, target: self, action: "Onb1ClickListener")
let button2 = UIBarButtonItem(image: UIImage(named: "icon2"), style: .Plain, target: self, action: "Onb2ClickListener")
let button3 = UIBarButtonItem(image: UIImage(named: "icon3"), style: .Plain, target: self, action: "Onb3ClickListener")
self.navigationItem.setRightBarButtonItems([button1, button2, button3], animated: false)
self.navigationItem.setHidesBackButton(true, animated: false)
Run Code Online (Sandbox Code Playgroud)
这有效,但我得到蓝色图像.我怎样才能得到没有着色的原始图像?
如何在UINavigationBar的左侧添加图像(不仅仅是图像的条形按钮)?
谢谢
ios ×7
swift ×7
android ×2
animation ×1
appdelegate ×1
debugging ×1
gradle ×1
realm ×1
uiimageview ×1
uitextview ×1
xcode ×1