UITableViewCell没有可见的@interface声明选择器didReceiveMemoryWarning

时间:2017-01-31 10:55:12

标签: ios uitableview tableview tableviewcell viewdidload

任何人都可以告诉我为什么会收到此错误

  

UITableViewCell没有可见的@interface声明选择器didReceiveMemoryWarning

使用以下代码时:

- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
}

2 个答案:

答案 0 :(得分:4)

因为CLion是一种可从cmake_minimum_required(VERSION 3.6) project(CImgProject) set(CMAKE_CXX_STANDARD 11) set(SOURCE_FILES main.cpp) add_executable(CImgProject ${SOURCE_FILES}) # You can alter these according to your needs, e.g if you don't need to display images - set(YOU_NEED_X11 0) set(YOU_NEED_X11 1) set(YOU_NEED_PNG 1) set(YOU_NEED_JPG 1) if(${YOU_NEED_X11} EQUAL 1) message(STATUS "Looking for X11...") find_package(X11 REQUIRED) include_directories(${X11_INCLUDE_DIR}) target_link_libraries(CImgProject ${X11_LIBRARIES}) else() target_compile_definitions(CImgProject PRIVATE cimg_display=0) endif() if(${YOU_NEED_JPG} EQUAL 1) message(STATUS "Looking for libjpg...") find_package(JPEG REQUIRED) include_directories(${JPEG_INCLUDE_DIR}) target_link_libraries (CImgProject ${JPEG_LIBRARY}) target_compile_definitions(CImgProject PRIVATE cimg_use_jpeg=1) endif() if(${YOU_NEED_PNG} EQUAL 1) message(STATUS "Looking for libpng...") find_package(PNG REQUIRED) include_directories(${PNG_INCLUDE_DIR}) target_link_libraries (CImgProject ${PNG_LIBRARY}) target_compile_definitions(CImgProject PRIVATE cimg_use_png=1) endif() 类继承而来的方法,并且它在didReceiveMemoryWarning()(继承自UIViewController)等类中不可用。

此外,当系统检测到运行内存不足时调用UITableViewCell

UIView

答案 1 :(得分:0)

请参阅apple doc:https://developer.apple.com/reference/uikit/uiviewcontroller/1621409-didreceivememorywarning

  

当应用收到内存警告时发送给视图控制器。

     

您的应用从不直接调用此方法。相反,当系统确定可用内存量较低时,将调用此方法。

所以,你应该知道这个被调用的方法是由低momery引起的。