【问题标题】:iphone code not firingiphone代码没有触发
【发布时间】:2010-10-09 11:48:15
【问题描述】:

我有一个我正在使用的类,但无法触发代码

WeatherServer.m
----------------------

- (NSArray *)weatherItemsForMapRegion:(MKCoordinateRegion)region maximumCount:(NSInteger)maxCount
{
//code is not firing
}




myviewcontroller.h
-----------------------
@class WeatherServer;

@interface MapView : UIViewController <MKMapViewDelegate, UITextFieldDelegate, CLLocationManagerDelegate, ADBannerViewDelegate> {

WeatherServer *weatherServer;
}

@property(nonatomic, retain) IBOutlet WeatherServer *weatherServer;

@end




myviewcontroller.m
----------------------

#import "WeatherServer.h"
@implementation MapView

@synthesize weatherServer;

- (void)mapView:(MKMapView *)map regionDidChangeAnimated:(BOOL)animated
{
NSArray *weatherItems = [weatherServer weatherItemsForMapRegion:mapView.region maximumCount:300];
    [mapView addAnnotations:weatherItems];
}

@end

regionDidChangeAnimated 可以触发,但是 weatherItemsForMapRegion 中的代码永远不会触发。

【问题讨论】:

  • 能否确认“weatherServer”对象初始化是否正确?
  • 据我所知。我应该怎么做才能测试这个?

标签: iphone


【解决方案1】:

我知道发生了什么。

我一直在通过界面生成器初始化类,但只为 iphone .xib 而不是我的 ipad .xib。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-16
    • 2017-04-23
    相关资源
    最近更新 更多