小编Ran*_*jit的帖子

以编程方式更改storyBoard的rootViewController

我使用了创建我的项目Storyboards.根ViewController在里面Storyboard,我没有写过单个代码appDelegate.

现在,我想告诉我的应用程序的巡演,所以我想根本改变ViewControllerTab Bar我TourVC,当应用程序的游览结束后,我想我的根再次切换回ViewControllerTab Bar.

所以我在网上查询并遵循以下几点

1)Storyboards从app.plist文件中删除,2)取消选中"isInitialViewController"选项Storyboards,在Tab Bar控制器的情况下检查该选项,因为它是根ViewController,3)在appDelegate.m文件中添加此代码.

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
ProductTourViewController *PT = [[ProductTourViewController alloc] initWithNibName:@"ProductTourViewController" bundle:nil];
self.window.rootViewController = PT;
[self.window makeKeyAndVisible];
return YES;
Run Code Online (Sandbox Code Playgroud)

但我的应用程序崩溃与此错误日志,

[ProductTourViewController selectedViewController]: unrecognized selector sent to instance 0x1766a9e0
Run Code Online (Sandbox Code Playgroud)

我也收到警告,

Unsupported Configuration: Scene is unreachable due to lack of entry points and does not have an identifier for …
Run Code Online (Sandbox Code Playgroud)

storyboard uiviewcontroller ios

46
推荐指数
4
解决办法
8万
查看次数

在iOS中找不到"GoogleMobileAds"模块

我使用Pod将Google AdMob SDK更新为7.1.0.

所以在我的appDelegate.m中,我试图添加这一行

@import GoogleMobileAds;

但我得到错误,说 找不到模块'GoogleMobileAds'.

谷歌在gitHub上的Interstial Ad示例中也出现此问题.

问候Ranjit

admob ios

32
推荐指数
6
解决办法
4万
查看次数

如何比较目标C中的两个NSDate对象

我有Date类型的对象..

所以我想比较它们,我在下面的方法中写了一个if条件

if (([startDate1 isEqualToDate:[self getDefaultDate]]) || (startDate1 != [ self getDefaultDate] && m_selectedDate >= m_currentDate1 && cycleStopped))
 {

///execute some condition

}
Run Code Online (Sandbox Code Playgroud)

所以无论我是对还是错......这种做法?

是否以这种方式纠正是正确的

if (dtdate > [m_array objectatIndex:i]
{

}
Run Code Online (Sandbox Code Playgroud)

因为我得到一个随机的行为..

所以请帮助我的朋友和极客

问候Ranjit

nsdate ios

31
推荐指数
3
解决办法
4万
查看次数

如何使用MFMailComposeViewController在电子邮件正文中添加图像

我试图找出在电子邮件正文中添加图像的最佳方式,而不是在ios中作为附件.

1)Apple提供了一个功能" addAttachment ",并且doc说,要在内容中添加任何图像,我们应该使用这个功能,但我尝试了这个功能,并发了一封邮件,我在浏览器上查了一下,就收到了一个附件.

2)其次,许多博客都说要使用base64编码,但这也不会起作用,图像会以破坏的形式发送.

所以朋友们,请帮助我找到最好的解决方案来做到这一点.

问候Ranjit

ios ios5 mfmailcomposeviewcontroller

23
推荐指数
2
解决办法
2万
查看次数

从另一个ViewController呈现storyboard ViewController

我的iOS App的Storyboard中有多个UIViewControllers.我想从另一个UIViewController打开一个UIViewControllers(在故事板中).

我已经尝试了下面的代码,但即使我在iOS 5之前使用它并且它工作正常它也无法正常工作.

- (IBAction)addNotes:(id)sender {
    NotesViewController *notesView = [[NotesViewController alloc] initWithNibName:@"NotesViewController" bundle:nil];
    [self presentModalViewController:notesView animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

如何使用iOS 5 Storyboards执行此操作?

uiviewcontroller ios ios5 uistoryboard

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

将cocoaPods用于google AdMob SDK

今天我尝试将GoogleAdMob SDK更新为6.12.因此,在阅读文档时,我发现谷歌建议使用cocoaPods来管理依赖项.我从之前的6.10 SDK文件中删除了我的项目,并执行如下操作.

所以我在我的机器上安装了cocoaPods,并按照adMob文档中给出的步骤进行操作

安装pod后,我从终端收到此消息

Installing Google-Mobile-Ads-SDK (6.12.0)
Generating Pods project
Integrating client project

[!] From now on use `abc.xcworkspace`.

[!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile:

    source 'https://github.com/CocoaPods/Specs.git'


[!] The `abc [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the …
Run Code Online (Sandbox Code Playgroud)

admob ios cocoapods

15
推荐指数
2
解决办法
6424
查看次数

过滤和排序swift数组

我有一个我要过滤的swift数组,这里是数组

let array = [apple,workshops,shopping,sports,parties,pantry,pen] 
Run Code Online (Sandbox Code Playgroud)

我想过滤数组,使得以搜索字符串开头项目出现在仅包含搜索字符串的项目之前

因此,当我搜索示例p时,结果应该是某种方式

let array = [parties,pantry,pen,apple,workshops,shopping,sports] 
Run Code Online (Sandbox Code Playgroud)

我试过这个

tagSearchResults = tagSearchResults.filter({ (interestTag:InterestTag) -> Bool in
            let tmp: NSString = interestTag.tag
            let range = tmp.rangeOfString(searchText, options: NSStringCompareOptions.CaseInsensitiveSearch)
            return range.location != NSNotFound
        })
Run Code Online (Sandbox Code Playgroud)

但这给了我包含搜索字符串的所有字符串.

那么伙计我怎么能这样做呢

arrays uisearchbar ios swift

13
推荐指数
2
解决办法
5863
查看次数

PageViewController委托函数调用两次

我正在使用UIPageViewController,为我的应用程序进行产品导览.

我按照这个链接http://www.appcoda.com/uipageviewcontroller-tutorial-intro/

我正在做的是根据我获得的索引值在滑动时更改我的"根VC"的背景颜色的简单任务,但是由于委托函数被调用两次,我的索引值不正确,因此,我不是能够做对,下面是我的代码

#import "APPViewController.h"
#import "APPChildViewController.h"

@interface APPViewController ()

@end

@implementation APPViewController

- (void)viewDidLoad {

    [super viewDidLoad];

    self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];

    self.pageController.dataSource = self;
    [[self.pageController view] setFrame:CGRectMake(0, 0, 320, 500)];

    APPChildViewController *initialViewController = [self viewControllerAtIndex:0];

    NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];

    [self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

    [self addChildViewController:self.pageController];
    [[self view] addSubview:[self.pageController view]];
    [self.pageController didMoveToParentViewController:self];

}

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.

}

- (APPChildViewController *)viewControllerAtIndex:(NSUInteger)index { …
Run Code Online (Sandbox Code Playgroud)

ios ios5 uipageviewcontroller ios6

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

从iphone应用程序以编程方式拨打电话,并在结束通话后返回应用程序

我正试图从我的iPhone应用程序发起呼叫,我按照以下方式做了...

-(IBAction) call:(id)sender
{

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Call Besito" message:@"\n\n\n"
                                                   delegate:self cancelButtonTitle:@"Cancel"  otherButtonTitles:@"Submit", nil];


    [alert show];
    [alert release];
}

- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
    if (buttonIndex != [alertView cancelButtonIndex])
    {
      NSString *phone_number = @"0911234567"; // assing dynamically from your code
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString    stringWithFormat:@"tel:%@", phone_number]]]; 
         NSString *phone_number = @"09008934848";
        NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",phone_number];
        NSURL *phoneURL = [[NSURL alloc] initWithString:phoneStr];
        [[UIApplication sharedApplication] openURL:phoneURL];
        [phoneURL release];
        [phoneStr release];
    }
}
Run Code Online (Sandbox Code Playgroud)

通过上面的代码.. 我能够成功拨打电话 .. 但是当我结束通话时,我无法返回我的应用程序

所以,我想知道如何实现,那也请告诉我如何使用webview发起呼叫......

谢谢和问候Ranjit

iphone objective-c ios4 ios

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

调整ModalViewController的大小并将其定位在iOS 7的中心位置

我试图通过减少其宽度和高度在iPad上显示modalView,但问题是它不是中心对齐的.在iOS 6中它过去工作正常,但在iOS 7中它不是中心对齐的.

以下是我的代码:

 m_helpQA = [[HelpQAViewController alloc]init];

 m_helpQA.modalPresentationStyle = UIModalPresentationFormSheet;      

 [self presentViewController:m_helpQA animated:YES completion:NULL];
 m_helpQA.view.superview.bounds = CGRectMake(0, 0, 350, 250);//Dimensions of ModalView.
Run Code Online (Sandbox Code Playgroud)

目前我正是这样做的

在此输入图像描述

ipad modalviewcontroller presentmodalviewcontroller ios7

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