小编Aao*_*oIi的帖子

缩放UIButton动画 - Swift

我正试图UIButton在点击时进行缩放动画,但我想要完成的是当按钮点击时我需要UIButton更小到内部然后它回到相同的大小(像气泡).

我尝试了以下方法:

button.transform = CGAffineTransformMakeScale(-1, 1)

UIView.animateWithDuration(0.5, animations: { () -> Void in

    button.transform = CGAffineTransformMakeScale(1,1)

})
Run Code Online (Sandbox Code Playgroud)

ios cgaffinetransformscale swift

65
推荐指数
8
解决办法
7万
查看次数

UICollectionView自定义单元格以填充宽度在Swift中

我一直试图弄清楚如何让细胞填充宽度,正如你在图片中看到的那样,细胞之间的宽度太大了.我使用只有一个imageView的自定义单元格.

在此输入图像描述

我试图从故事板中自定义它,但我想没有选择,或者它应该以编程方式完成. 在此输入图像描述

我的UICollectionViewController:

 @IBOutlet var collectionView2: UICollectionView!

    let recipeImages = ["angry_birds_cake", "creme_brelee", "egg_benedict", "full_breakfast", "green_tea", "ham_and_cheese_panini", "ham_and_egg_sandwich", "hamburger", "instant_noodle_with_egg.jpg", "japanese_noodle_with_pork", "mushroom_risotto", "noodle_with_bbq_pork", "starbucks_coffee", "thai_shrimp_cake", "vegetable_curry", "white_chocolate_donut"]

    override func viewDidLoad() {
        super.viewDidLoad()

        // Uncomment the following line to preserve selection between presentations
        // self.clearsSelectionOnViewWillAppear = false

        // Do any additional setup after loading the view.

    }


    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        //#warning Incomplete method …
Run Code Online (Sandbox Code Playgroud)

ios uicollectionview uicollectionviewlayout swift

34
推荐指数
4
解决办法
7万
查看次数

move_uploaded_file无法打开流:权限被拒绝 - Mac

虽然我尝试使用以下代码在php中move_uploaded_file:

if(is_uploaded_file($_FILES['fileupload2']['tmp_name'])){

        move_uploaded_file($_FILES['fileupload2']['tmp_name'], "images/".$_FILES['fileupload2']['name']);

    }
Run Code Online (Sandbox Code Playgroud)

我有这个错误说:

Warning: move_uploaded_file(images/VIDEO_TS.VOB): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/Week3/Lesson2/do_upload.php on line 24
Run Code Online (Sandbox Code Playgroud)

我在终端尝试过但没有工作:

sudo CHMOD 775 /Applications/XAMPP/xamppfiles/htdocs/Week3/Lesson2/do_upload.php 

sudo chmod -R 0755 /Applications/XAMPP/xamppfiles/htdocs/Week3/Lesson2/do_upload.php 

sudo chown nobody /Applications/XAMPP/xamppfiles/htdocs/Week3/Lesson2/do_upload.php 
Run Code Online (Sandbox Code Playgroud)

我仍然得到错误,我正在使用优胜美地,任何其他解决方案?

php apache xampp upload file-upload

13
推荐指数
1
解决办法
3万
查看次数

微信Api无法设置应用程序图标

我一直在努力将水印和高分辨率的图标图像上传到微信api,同时注册iOS应用程序,这里发生了什么:

查看网站:http: //developers.wechat.com/

我尝试了不同的方式上传28*28 png透明与否和灰度,它真的很烦人,它不会去任何地方加上微信支持他们没有响应.而高分辨率图标也有同样的问题.

错误始终是:Unable to set the icon因此无法验证我的应用.

在此输入图像描述

ios wechat

11
推荐指数
1
解决办法
1652
查看次数

对于iOS 10,请在每周的特定日期重复UserNotification

我正在研究iOS 10的本地通知调度模块,它可以重复本地通知,例如每个星期天或每个星期一......等等.假设我安排了这个日期的通知,2016-12-27 10:53:22 +0000并且使用UNCalendarNotificationTrigger重复值等于true,通知会在该日期触发,并且不会在下周同时重复.

可能是什么原因?如何在iOS 10中的特定日期每周重复一次.

以下是创建本地通知的代码:

 let content = UNMutableNotificationContent()
 content.title = object.title
 content.body = object.body
 content.sound = UNNotificationSound.default()

 let date = object.fireDate
 let triggerDate =  Calendar.current.dateComponents([.year,.month,.day,.hour,.minute,.second,], from: date as Date)

 let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDate,
                                                            repeats: true)
 // Swift
 let identifier = object.id
 let request = UNNotificationRequest(identifier: identifier,
                                                    content: content, trigger: trigger)
 localNotification.add(request, withCompletionHandler: { (error) in

  if error != nil  {
   // Something went wrong
   print(error!)

   }else {

   print("Reminder \(object.id) has been added …
Run Code Online (Sandbox Code Playgroud)

swift ios10 usernotifications

8
推荐指数
1
解决办法
3283
查看次数

Pod安装命令有错误

我一直在尝试使用cocoapods它并将它们安装到我的项目中但它在尝试将其安装到项目位置时给了我这个错误.它有点令人困惑?

/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/lib/cocoapods/command.rb:127: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.37.2/lib/cocoapods-core/standard_error.rb:88:in `message': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:367:in `handle_exception'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:315:in `rescue in run'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:303:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/lib/cocoapods/command.rb:46:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.37.2/bin/pod:44:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'
Run Code Online (Sandbox Code Playgroud)

xcode ios cocoapods

7
推荐指数
1
解决办法
1509
查看次数

动态自定义UITableViewCell的高度基于Swift中的标签文本长度

我一直在尝试使用swift做一个动态单元格,使用swift来支持IOS7,heightForRowAtIndexPath但我只找到了Objective-c代码,是否可以让其他人帮助我将这段代码重写为swift?

 // Fetch yourText for this row from your data source..
    NSString *yourText = [yourArray objectAtIndex:indexPath.row];

    CGSize lableWidth = CGSizeMake(300, CGFLOAT_MAX); // 300 is fixed width of label. You can change this value
    CGSize requiredSize = [yourText sizeWithFont:[UIFont fontWithName:@"Times New Roman" size:19] constrainedToSize:lableWidth lineBreakMode:NSLineBreakByWordWrapping]; // You can put your desire font

    // Here, you will have to use this requiredSize and based on that, adjust height of your cell. I have added 10 on total required height of …
Run Code Online (Sandbox Code Playgroud)

ios swift

6
推荐指数
1
解决办法
2463
查看次数

禁用UIPageViewController弹跳 - Swift

我一直在制作一个带有滚动的示例应用程序,UIViewControllers但关键是我想在滚动结束时和返回第一个时禁用弹跳效果UIViewController.

这是我的代码:

class PageViewController: UIPageViewController,UIPageViewControllerDataSource, UIPageViewControllerDelegate{

    var index = 0
    var identifiers: NSArray = ["FirstNavigationController", "SecondNavigationController"]
    override func viewDidLoad() {

        self.dataSource = self
        self.delegate = self

        let startingViewController = self.viewControllerAtIndex(self.index)

        let viewControllers: NSArray = [startingViewController]
        self.setViewControllers(viewControllers as [AnyObject], direction: UIPageViewControllerNavigationDirection.Forward, animated: false, completion: nil)
    }

    func viewControllerAtIndex(index: Int) -> UINavigationController! {

        let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
        //first view controller = firstViewControllers navigation controller
        if index == 0 {

            return storyBoard.instantiateViewControllerWithIdentifier("FirstNavigationController") as! UINavigationController

        } …
Run Code Online (Sandbox Code Playgroud)

uiscrollview ios uipageviewcontroller swift

6
推荐指数
1
解决办法
6342
查看次数

如何经常更新ViewPager?

我面临着ViewPagerClass 的麻烦,我有三个页面,每个都有一个scrollView,相对布局和ImageView里面.

我点击ImageView时需要设置彩色背景.我的问题是:当我点击一个ImageView让它背景颜色时,背景颜色出现ImageView在另一个PagerView页面的另一个...

对于实例:我有四个页面,每个页面都加载了一个ImageView,当我点击第一页面中的第一个ImageView时,第二个ViewPager页面中的ImageView 得到了背景颜色.

我需要让我的第一个ImageView(在第一页)进行背景化.

这是代码......这是我的寻呼机适配器类

    public class ViewPagerAdapter extends PagerAdapter {
        private DataSetObserver mObserver;
        ImageView image,image2;
        Activity activity;
        int imageArray[];
        Point p;


        public ViewPagerAdapter(Activity act, int[] imgArra) {
            imageArray = imgArra;
            activity = act;
        }

        @Override
        public int getItemPosition(Object object) {
            // TODO Auto-generated method stub
            return super.getItemPosition(object);
        }

        public int getCount() {
            return imageArray.length;
        }

        public Object instantiateItem(View collection, int position) {
            int …
Run Code Online (Sandbox Code Playgroud)

android viewpagerindicator android-pageradapter

5
推荐指数
1
解决办法
407
查看次数

UISearchBar的set_cancelButtonText:禁止使用ivar

以前在iOS 12中允许使用相同的代码,但是现在当我尝试在iOS 13上运行相同的代码时,它崩溃,给我同样的错误:

由于未捕获的异常“ NSGenericException”而终止应用程序,原因:禁止访问UISearchBar的set_cancelButtonText:ivar。这是一个应用程序错误”

与此代码行相关:

searchController.searchBar.setValue("Cancel".localized, forKey:"_cancelButtonText")
Run Code Online (Sandbox Code Playgroud)

现在我知道现在禁止访问setValue,但是如何克服此崩溃并更改“取消”按钮的标题,因为搜索栏中不包含任何属性。

swift ios13

5
推荐指数
1
解决办法
1033
查看次数