Tag: 目标C

UIPageControl和UIPageviewController不同步

我有一个显示7页的UIPageViewController。 我注意到这个奇怪的问题:每当你滑动页面控制器,并点击底部的Uipagecontrol,在滑动的相反方向,同时当前正在显示的页面和页面控件中的页码将不同步。 有没有人有这个奇怪的问题,并解决了它。 请帮帮我。 请让我知道如果你需要任何额外的信息。

将第三方库ZXing导入Xcode

我已经尝试了很多方法来将第三方库'ZXing'导入到我的iOS应用程序中,但都是痛苦的,或者根本不起作用。 如果有人可以build议我做错了什么,或者更好的方法来导入ZXing这样的图书馆,我会非常感激。 它一定比这更容易! 这是我所做的,结果: MyGreatApp的目录结构(撰写本文时) /MyGreatApp/MyGreatApp.xcworkspace (main workspace that compiles the application) /MyGreatApp/Projects/MyGreatApp/MyGreatApp.xcodeproj /MyGreatApp/Projects/MyGreatApp/(All source code for MyGreatApp) /MyGreatApp/Projects/other-inhouse-project/other-inhouse-project/other-inhouse-project.xcodeproj /MyGreatApp/Projects/other-inhouse-project/other-inhouse-project/(Source code for other-inhouse-project) /MyGreatApp/Projects/other-inhouse-project/RestKit/RestKit.xcodeproj /MyGreatApp/Projects/other-inhouse-project/RestKit/(source code for restKit) 将ZXing项目添加到工作区: 从git hub下载项目: https : //github.com/TheLevelUp/ZXingObjC (最新版本) 复制项目到/项目(在SVN回购)。 打开MyGreatApp工作区,“添加文件” – >select“ZXingObjC.xcodeproj”。 将已编译的库(libZXingObjC-iOS.a)添加到MyGreatApp构build阶段,从ZXing产品中拖放。 添加ZXing所需的框架。 在标题searchpath和库searchpath中添加ZXing的path。 “$(PROJECT_DIR)/../../ Projects / ZXingObjC-2.2.6 / ZXingObjC”。 使用$(PROJECT_DIR),所以path是相对的,可以在所有的构build机器上运行。 改变ZXing生成设置不使用arm64体系结构,因为我们目前不支持它由于旧的restKit库。 为了构build其他configuration,我唯一find的解决scheme是在ZXing项目中添加一个完全相同名称的configuration,即添加QA(PAT12),QA(PAT14)等等(这并不理想) 结果: 项目编译和工作正常,但上述步骤是相当耗时的。 编译ZXing不会产生错误警告。 可以使用 […]

MonoTouch.Foundation.MonoTouchException已经抛出了Objective-Cexception。 名称:NSInternalInconsistencyException

当我在Xamarin中运行我的iOS应用程序时,我似乎遇到了这个问题。 MonoTouch.Foundation.MonoTouchException has been thrown Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Could not load NIB in bundle: 'NSBundle … (loaded)' with name 'RouteMeViewController' 我正在尝试用一个RouteMeViewController来replace一个GoogleMapsViewController,在一个应用程序中使用Objective C库和Binder进行工作。 我的AppDelegate看起来像这样: namespace ExampleApp.iOS { [Register ("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate { UIWindow window; RouteMeViewController viewController; public override bool FinishedLaunching (UIApplication app, NSDictionary options) { window = new UIWindow […]

iOS iPad故事板未被选中

看起来,即使我指定了Xcode 5,也没有select使用iPad设备作为iPad设备。 这就是我告诉Xcode 5使用iPad的故事板: 我去了General下的项目设置 所选设备: Universal 然后我点击iPad 在Main Interface写下MainStoryboard-iPad.storyboard 但由于某些原因,即使我对MainStoryboard-iPad故事板进行了更改,但是当我尝试在iPad上运行故事板时,它并未显示出来。 我的项目中只有两个故事板 MainStoryboard-iPad.storyboard 和 MainStoryboard.storyboard 任何想法可能是错误的吗? 哦,顺便说一下,当我第一次select环球时,我有一个箱子问我有关复制的事情(我从来没有仔细阅读过)。 我只是打“是” 不知道那个盒子实际上做了什么。 编辑 在我的AppDelegate.m中运行的代码 – (void)applicationDidBecomeActive:(UIApplication *)application { AppDelegate *app = [[UIApplication sharedApplication] delegate]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; UIViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"mainStoryBoard"]; UINavigationController *nvc = (UINavigationController*)self.window.rootViewController; app.window.rootViewController = ivc; }

Xcode是自动添加信息图标/“附件button”我的表格单元格

最近,当我尝试使用故事板向我的UITableView单元添加一个seque时: Xcode是自动添加信息图标/“附件button”到单元格: 我知道我可以像这样删除它: 但是,似乎还有其他问题可能也是什么导致这种行为的症状,但这是一个单独的问题…我的问题是为什么Xcode添加它在第一个地方? 当我添加故事板seques时,从来没有这样做过…

如何子类UILabel,UIButton等UI元素

我在CustomLabel class中CustomLabel class UILabel 。 当我尝试使用一个简单的UILabel时,我遇到了一些问题,并且我希望将来能够inheritance其他元素。 我读过,我可以创build一个UILabel category 。 哪个更好? 类别或子类? 这是我的代码试图子类。 它在setFont方法中失败。 @interface WPCustomLabel : UILabel @property (strong, nonatomic) UIColor *color; @property (strong, nonatomic) UIFont *font; @end #import "WPCustomLabel.h" @implementation WPCustomLabel – (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setBackgroundColor:[UIColor clearColor]]; } return self; } -(void)setColor:(UIColor *)color { self.color = color; […]

Swift:如何从Objective-C调用一个类或类的方法

我在UIImage上有一个用Objective-C编写的类。 以下是一些示例方法。 我如何在Swift中调用这些方法? +(UIImage *) imageOrPDFNamed:(NSString *)resourceName; +(UIImage *) imageWithPDFNamed:(NSString *)resourceName; 我已经尝试了以下,它不承认的方法: let image = UIImage(imageOrPDFNamed:"test.pdf") let image = UIImage(PDFNamed:"test.pdf")

更改文字后无法更改UISearchBar取消button的标题颜色。

我正在使用此代码来更改UISearchBar取消button标题: -(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{ self.searchDisplayController.searchBar.showsCancelButton = YES; UIView* view=_otsinguRiba.subviews[0]; for (UIView *subView in view.subviews) { if ([subView isKindOfClass:[UIButton class]]) { UIButton *cancelButton = (UIButton*)subView; if (cancelButton) { [cancelButton setTitle:@"Test") forState:UIControlStateNormal]; [cancelButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; } } } } 虽然改变文字工作正常,改变颜色不。 它保持黑色。

NSDictionary <FBGraphUser> *用户语法说明

在Facebook iOS SDK请求返回以下处理程序: ^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) { } 用户variables,然后可以像这些调用访问… self.userNameLabel.text = user.name; self.userProfileImage.profileID = user.id; 这个语法有点类似于语法id <protocolDelegate> object语法,它是一个通用的属性声明,除了NSDictionary明确地是id对象,并且该字典符合协议? 但是,点语法是从哪里来的,以及如何声明一个任意的NSFoundation对象对应于一个协议,而不需要将对象本身进行子类化并使之符合? 我做了点符号和NSDictionary的一些额外的研究,似乎是不可能在字典上使用点符号而不添加一个类别NSDictionary。 但是,我没有在Apple文档中看到任何有关<>语法的参考,表明这个特定的NSDictionary实例符合这个符号。 Facebook的文档在这个包装的工作方式上有点稀疏: FBGraphUser协议代表了Facebook用户对象最常用的属性。 它可以用来访问已经用FBGraphObject外观包装的NSDictionary对象。 如果遵循这个导致FBGraphObject文档,那么有方法返回符合这个“门面…”的字典,但没有进一步解释如何包装字典。 所以我想我的问题是几个: 下面的代码看起来像什么使这种语法工作? 它为什么存在? 为什么Facebook会以这种方式实现它,而不是仅仅把一个对象转换成数据呢? 任何解释或见解将非常感激!

在向下滚动然后备份之后,UITableViewCells会发生变化

我有一个UITableView,当我向下滚动和备份时,值在单元格的UILabels中变化。 我无法弄清楚为什么会发生这种情况。 我使用自定义的UITableViewCells,我自己subclassed。 这就是我的代码看起来像减去input到标签的所有值,因为我认为错误是不存在,但以我声明tableview委托方法或类似的东西大声笑。 – (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. if (sortedItemsArray == nil) { return 0; } else return [sortedItemsArray count]; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = […]